Ignore:
Timestamp:
May 20, 2009, 6:46:53 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/client/cifs.upcall.c

    r203 r204  
    3030#include "cifs_spnego.h"
    3131
    32 const char *CIFSSPNEGO_VERSION = "1.1";
     32const char *CIFSSPNEGO_VERSION = "1.2";
    3333static const char *prog = "cifs.upcall";
    3434typedef enum _secType {
     35        NONE = 0,
    3536        KRB5,
    3637        MS_KRB5
     
    5758 * ret: 0 - success, others - failure
    5859*/
    59 int handle_krb5_mech(const char *oid, const char *principal,
     60static int
     61handle_krb5_mech(const char *oid, const char *principal,
    6062                     DATA_BLOB * secblob, DATA_BLOB * sess_key)
    6163{
     
    7476
    7577        /* and wrap that in a shiny SPNEGO wrapper */
    76         *secblob = gen_negTokenInit(OID_KERBEROS5, tkt_wrapped);
     78        *secblob = gen_negTokenInit(oid, tkt_wrapped);
    7779
    7880        data_blob_free(&tkt_wrapped);
     
    8991#define DKD_MUSTHAVE_SET (DKD_HAVE_HOSTNAME|DKD_HAVE_VERSION|DKD_HAVE_SEC)
    9092
    91 int decode_key_description(const char *desc, int *ver, secType_t * sec,
     93static int
     94decode_key_description(const char *desc, int *ver, secType_t * sec,
    9295                           char **hostname, uid_t * uid)
    9396{
     
    119122                                retval |= DKD_HAVE_SEC;
    120123                                *sec = KRB5;
     124                        } else if (strncmp(tkn + 4, "mskrb5", 6) == 0) {
     125                                retval |= DKD_HAVE_SEC;
     126                                *sec = MS_KRB5;
    121127                        }
    122128                } else if (strncmp(tkn, "uid=", 4) == 0) {
     
    149155}
    150156
    151 int cifs_resolver(const key_serial_t key, const char *key_descr)
     157static int
     158cifs_resolver(const key_serial_t key, const char *key_descr)
    152159{
    153160        int c;
     
    201208}
    202209
    203 void
     210static void
    204211usage(void)
    205212{
     
    213220        DATA_BLOB secblob = data_blob_null;
    214221        DATA_BLOB sess_key = data_blob_null;
    215         secType_t sectype;
     222        secType_t sectype = NONE;
    216223        key_serial_t key = 0;
    217224        size_t datalen;
    218225        long rc = 1;
    219         uid_t uid;
    220         int kernel_upcall_version;
     226        uid_t uid = 0;
     227        int kernel_upcall_version = 0;
    221228        int c, use_cifs_service_prefix = 0;
    222229        char *buf, *hostname = NULL;
     230        const char *oid;
    223231
    224232        openlog(prog, 0, LOG_DAEMON);
     
    281289        SAFE_FREE(buf);
    282290
    283         if (kernel_upcall_version != CIFS_SPNEGO_UPCALL_VERSION) {
     291        if (kernel_upcall_version > CIFS_SPNEGO_UPCALL_VERSION) {
    284292                syslog(LOG_WARNING,
    285293                       "incompatible kernel upcall version: 0x%x",
     
    302310        // do mech specific authorization
    303311        switch (sectype) {
     312        case MS_KRB5:
    304313        case KRB5:{
    305314                        char *princ;
     
    320329                        strlcpy(princ + 5, hostname, len - 5);
    321330
    322                         rc = handle_krb5_mech(OID_KERBEROS5, princ,
    323                                               &secblob, &sess_key);
     331                        if (sectype == MS_KRB5)
     332                                oid = OID_KERBEROS5_OLD;
     333                        else
     334                                oid = OID_KERBEROS5;
     335
     336                        rc = handle_krb5_mech(oid, princ, &secblob, &sess_key);
    324337                        SAFE_FREE(princ);
    325338                        break;
     
    345358                goto out;
    346359        }
    347         keydata->version = CIFS_SPNEGO_UPCALL_VERSION;
     360        keydata->version = kernel_upcall_version;
    348361        keydata->flags = 0;
    349362        keydata->sesskey_len = sess_key.length;
Note: See TracChangeset for help on using the changeset viewer.