~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/ccapi/server/win/ccs_request_proc.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2009-05-07 16:16:34 UTC
  • mfrom: (13.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090507161634-xqyk0s9na0le4flj
Tags: 1.7dfsg~beta1-4
When  decrypting the TGS response fails with the subkey, try with the
session key to work around Heimdal bug, Closes: #527353 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Header$
 
3
 *
 
4
 * Copyright 2008 Massachusetts Institute of Technology.
 
5
 * All Rights Reserved.
 
6
 *
 
7
 * Export of this software from the United States of America may
 
8
 * require a specific license from the United States Government.
 
9
 * It is the responsibility of any person or organization contemplating
 
10
 * export to obtain such a license before exporting.
 
11
 *
 
12
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 
13
 * distribute this software and its documentation for any purpose and
 
14
 * without fee is hereby granted, provided that the above copyright
 
15
 * notice appear in all copies and that both that copyright notice and
 
16
 * this permission notice appear in supporting documentation, and that
 
17
 * the name of M.I.T. not be used in advertising or publicity pertaining
 
18
 * to distribution of the software without specific, written prior
 
19
 * permission.  Furthermore if you modify this software you must label
 
20
 * your software as modified software and not distribute it in such a
 
21
 * fashion that it might be confused with the original M.I.T. software.
 
22
 * M.I.T. makes no representations about the suitability of
 
23
 * this software for any purpose.  It is provided "as is" without express
 
24
 * or implied warranty.
 
25
 */
 
26
 
 
27
#include <stdlib.h>
 
28
#include <stdio.h>
 
29
 
 
30
#include "ccs_request.h"    // header file generated by MIDL compiler
 
31
#include "cci_debugging.h"
 
32
#include "WorkQueue.h"
 
33
#include "win-utils.h"
 
34
#include "ccs_win_pipe.h"
 
35
 
 
36
void ccs_rpc_request(
 
37
    const long  rpcmsg,             /* Message type */
 
38
    const char  tspHandle[],        /* Client's tspdata* */
 
39
    const char* pszUUID,            /* Where client will listen for the reply */
 
40
    const long  lenRequest,         /* Length of buffer */
 
41
    const char  pbRequest[],        /* Data buffer */
 
42
    const long  serverStartTime,    /* Which server session we're talking to */
 
43
    long*       return_status ) {   /* Return code */
 
44
 
 
45
    cc_int32        status  = 0;
 
46
    k5_ipc_stream    stream;
 
47
    DWORD*          p       = (DWORD*)(tspHandle);
 
48
    WIN_PIPE*       pipe    = NULL;
 
49
#if 0
 
50
    cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>", __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
 
51
#endif
 
52
    status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);
 
53
    
 
54
    if (!status) {                         
 
55
        status = k5_ipc_stream_new (&stream);  /* Create a stream for the request data */
 
56
        }
 
57
 
 
58
    if (!status) {                          /* Put the data into the stream */
 
59
        status = k5_ipc_stream_write (stream, pbRequest, lenRequest);
 
60
        }
 
61
 
 
62
    pipe = ccs_win_pipe_new(pszUUID, *p);    
 
63
    worklist_add(rpcmsg, pipe, stream, serverStartTime);
 
64
    *return_status = status;
 
65
    }
 
66
 
 
67
 
 
68
void ccs_rpc_connect(
 
69
    const long  rpcmsg,             /* Message type */
 
70
    const char  tspHandle[],        /* Client's tspdata* */
 
71
    const char* pszUUID,            /* Data buffer */
 
72
    long*       return_status ) {   /* Return code */
 
73
 
 
74
    DWORD*      p       = (DWORD*)(tspHandle);
 
75
    WIN_PIPE*   pipe    = ccs_win_pipe_new(pszUUID, *p);
 
76
#if 0
 
77
    cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);
 
78
#endif
 
79
    worklist_add(   rpcmsg, 
 
80
                    pipe,
 
81
                    NULL,               /* No payload with connect request */
 
82
                    (const time_t)0 );  /* No server session number with connect request */
 
83
    }
 
84
 
 
85
 
 
86
// 'Authentication' is client setting a value in a file and the server
 
87
//   returning that value plus one.
 
88
CC_UINT32 ccs_authenticate(const CC_CHAR* name) {
 
89
    HANDLE      hMap    = 0;
 
90
    PDWORD      pvalue  = 0;
 
91
    CC_UINT32   result  = 0;
 
92
    DWORD       status  = 0;
 
93
#if 0
 
94
    cci_debug_printf("%s ( %s )", __FUNCTION__, name);
 
95
#endif
 
96
    hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, (LPSTR)name);
 
97
    status  = !hMap;
 
98
 
 
99
    if (!status) {
 
100
        pvalue = (PDWORD)MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, 0);
 
101
        status = !pvalue;
 
102
        }
 
103
 
 
104
    if (!status) {
 
105
        *pvalue += 1;
 
106
        result = *pvalue;
 
107
        }
 
108
 
 
109
    if (pvalue) {
 
110
        UnmapViewOfFile(pvalue);
 
111
        }
 
112
 
 
113
    if (hMap) CloseHandle(hMap);
 
114
    return result;
 
115
    }
 
 
b'\\ No newline at end of file'