r4070: move some defines from asn_1.h to the places they belong to
authorStefan Metzmacher <metze@samba.org>
Sun, 5 Dec 2004 16:29:27 +0000 (16:29 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:06:22 +0000 (13:06 -0500)
metze
(This used to be commit ab2c2f27e1c61516e885f02bf26350f97209057a)

12 files changed:
source4/include/asn_1.h
source4/libcli/auth/gensec.h
source4/libcli/auth/gensec_krb5.c
source4/libcli/auth/gensec_ntlmssp.c
source4/libcli/auth/gssapi_parse.c
source4/libcli/auth/kerberos.h
source4/libcli/auth/spnego.c
source4/libcli/auth/spnego_parse.c
source4/libcli/raw/clisession.c
source4/smb_server/negprot.c
source4/smb_server/sesssetup.c
source4/utils/ntlm_auth.c

index 4243f6d31f55c32852245cab0bc9d3885868a5fc..2dc9bef06d99158df49d187fa20bf5bffa2a6eda 100644 (file)
@@ -50,21 +50,4 @@ struct asn1_data {
 
 #define ASN1_MAX_OIDS 20
 
-/* some well known object IDs */
-#define OID_SPNEGO "1 3 6 1 5 5 2"
-#define OID_NTLMSSP "1 3 6 1 4 1 311 2 2 10"
-#define OID_KERBEROS5_OLD "1 2 840 48018 1 2 2"
-#define OID_KERBEROS5 "1 2 840 113554 1 2 2"
-
-#define SPNEGO_NEG_RESULT_ACCEPT 0
-#define SPNEGO_NEG_RESULT_INCOMPLETE 1
-#define SPNEGO_NEG_RESULT_REJECT 2
-
-/* not really ASN.1, but RFC 1964 */
-#define TOK_ID_KRB_AP_REQ      "\x01\x00"
-#define TOK_ID_KRB_AP_REP      "\x02\x00"
-#define TOK_ID_KRB_ERROR       "\x03\x00"
-#define TOK_ID_GSS_GETMIC      "\x01\x01"
-#define TOK_ID_GSS_WRAP                "\x02\x01"
-
 #endif /* _ASN_1_H */
index 23d9861cb766d8dfdc45ef1d544f221b8711113a..f8b7e292e8442ef3ae5925634da311f5e9c6fc68 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#define GENSEC_OID_NTLMSSP "1 3 6 1 4 1 311 2 2 10"
+#define GENSEC_OID_SPNEGO "1 3 6 1 5 5 2"
+#define GENSEC_OID_KERBEROS5 "1 2 840 113554 1 2 2"
+#define GENSEC_OID_KERBEROS5_OLD "1 2 840 48018 1 2 2"
+#define GENSEC_OID_KERBEROS5_USER2USER "1 2 840 113554 1 2 2 3"
 
 struct gensec_security;
 struct gensec_user {
index 0f1bf8e7006c77db60b897bde058b7671e983763..c47d4f26b6f2bd95ffd4734759cb95862540b3da 100644 (file)
@@ -29,7 +29,6 @@
 #include "libcli/auth/kerberos.h"
 #include "librpc/gen_ndr/ndr_krb5pac.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
@@ -754,7 +753,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
 static const struct gensec_security_ops gensec_krb5_security_ops = {
        .name           = "krb5",
        .auth_type      = DCERPC_AUTH_TYPE_KRB5,
-       .oid            = OID_KERBEROS5,
+       .oid            = GENSEC_OID_KERBEROS5,
        .client_start   = gensec_krb5_client_start,
        .server_start   = gensec_krb5_server_start,
        .update         = gensec_krb5_update,
@@ -766,7 +765,7 @@ static const struct gensec_security_ops gensec_krb5_security_ops = {
 static const struct gensec_security_ops gensec_ms_krb5_security_ops = {
        .name           = "ms_krb5",
        .auth_type      = DCERPC_AUTH_TYPE_KRB5,
-       .oid            = OID_KERBEROS5_OLD,
+       .oid            = GENSEC_OID_KERBEROS5_OLD,
        .client_start   = gensec_krb5_client_start,
        .server_start   = gensec_krb5_server_start,
        .update         = gensec_krb5_update,
index 5e55082c6f6cb9e7342e43eff1d2a76fc0670f6b..147e2359f428ce0d013502c2da22cfeb3705f9db 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "includes.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 
 struct gensec_ntlmssp_state {
        struct auth_context *auth_context;
@@ -401,7 +400,7 @@ static const struct gensec_security_ops gensec_ntlmssp_security_ops = {
        .name           = "ntlmssp",
        .sasl_name      = "NTLM",
        .auth_type      = DCERPC_AUTH_TYPE_NTLMSSP,
-       .oid            = OID_NTLMSSP,
+       .oid            = GENSEC_OID_NTLMSSP,
        .client_start   = gensec_ntlmssp_client_start,
        .server_start   = gensec_ntlmssp_server_start,
        .update         = gensec_ntlmssp_update,
index 529799955dd70cb658e0151307efe67d1a5f97af..63bca6d5aaf254a2a032555bee9dad1cabfc79ff 100644 (file)
@@ -24,6 +24,9 @@
 
 #include "includes.h"
 #include "asn_1.h"
+#include "system/kerberos.h"
+#include "libcli/auth/kerberos.h"
+#include "libcli/auth/gensec.h"
 
 /*
   generate a krb5 GSS-API wrapper packet given a ticket
@@ -36,7 +39,7 @@ DATA_BLOB gensec_gssapi_gen_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *tick
        ZERO_STRUCT(data);
 
        asn1_push_tag(&data, ASN1_APPLICATION(0));
-       asn1_write_OID(&data, OID_KERBEROS5);
+       asn1_write_OID(&data, GENSEC_OID_KERBEROS5);
 
        asn1_write(&data, tok_id, 2);
        asn1_write(&data, ticket->data, ticket->length);
@@ -64,7 +67,7 @@ BOOL gensec_gssapi_parse_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, D
 
        asn1_load(&data, *blob);
        asn1_start_tag(&data, ASN1_APPLICATION(0));
-       asn1_check_OID(&data, OID_KERBEROS5);
+       asn1_check_OID(&data, GENSEC_OID_KERBEROS5);
 
        data_remaining = asn1_tag_remaining(&data);
 
index 9d6a5e81ae424725fdbf0ad147e45fa286018051..3ab71f78750a2980b61db020220011f1a391cca0 100644 (file)
 
 #if defined(HAVE_KRB5)
 
+/* not really ASN.1, but RFC 1964 */
+#define TOK_ID_KRB_AP_REQ      "\x01\x00"
+#define TOK_ID_KRB_AP_REP      "\x02\x00"
+#define TOK_ID_KRB_ERROR       "\x03\x00"
+#define TOK_ID_GSS_GETMIC      "\x01\x01"
+#define TOK_ID_GSS_WRAP                "\x02\x01"
+
 #ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE
 #define KRB5_KEY_TYPE(k)       ((k)->keytype)
 #define KRB5_KEY_LENGTH(k)     ((k)->keyvalue.length)
index 3af1bc1e81fe0bfeaaeb240e90d74c94fc0d565a..a13afbb186f772518948e43495c820e75c5450be 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "includes.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
@@ -218,7 +217,7 @@ static NTSTATUS gensec_spnego_server_try_fallback(struct gensec_security *gensec
                if (!all_ops[i]->oid) {
                        continue;
                }
-               if (strcasecmp(OID_SPNEGO,all_ops[i]->oid) == 0) {
+               if (strcasecmp(GENSEC_OID_SPNEGO,all_ops[i]->oid) == 0) {
                        continue;
                }
 
@@ -311,7 +310,7 @@ static NTSTATUS gensec_spnego_client_negTokenInit(struct gensec_security *gensec
        const char **mechTypes = NULL;
        DATA_BLOB unwrapped_out = data_blob(NULL,0);
 
-       mechTypes = gensec_security_oids(out_mem_ctx, OID_SPNEGO);
+       mechTypes = gensec_security_oids(out_mem_ctx, GENSEC_OID_SPNEGO);
 
        if (!mechTypes) {
                DEBUG(1, ("no GENSEC OID backends available\n"));
@@ -467,7 +466,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
                        
                        return nt_status;
                } else {
-                       const char **mechlist = gensec_security_oids(out_mem_ctx, OID_SPNEGO);
+                       const char **mechlist = gensec_security_oids(out_mem_ctx, GENSEC_OID_SPNEGO);
                        const char *mechListMIC;
 
                        mechListMIC = talloc_asprintf(out_mem_ctx,"%s$@%s",
@@ -712,7 +711,7 @@ static const struct gensec_security_ops gensec_spnego_security_ops = {
        .name           = "spnego",
        .sasl_name      = "GSS-SPNEGO",
        .auth_type      = DCERPC_AUTH_TYPE_SPNEGO,
-       .oid            = OID_SPNEGO,
+       .oid            = GENSEC_OID_SPNEGO,
        .client_start   = gensec_spnego_client_start,
        .server_start   = gensec_spnego_server_start,
        .update         = gensec_spnego_update,
index 2cf38728a9b60f216756f12dc82aef1b5ead7c0b..32e98a42354e6c8d9f0c637cc1e9593d5ddd538b 100644 (file)
@@ -288,7 +288,7 @@ ssize_t spnego_read_data(DATA_BLOB data, struct spnego_data *token)
                switch (context) {
                case ASN1_APPLICATION(0):
                        asn1_start_tag(&asn1, ASN1_APPLICATION(0));
-                       asn1_check_OID(&asn1, OID_SPNEGO);
+                       asn1_check_OID(&asn1, GENSEC_OID_SPNEGO);
                        if (read_negTokenInit(&asn1, &token->negTokenInit)) {
                                token->type = SPNEGO_NEG_TOKEN_INIT;
                        }
@@ -321,7 +321,7 @@ ssize_t spnego_write_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct spnego_da
        switch (spnego->type) {
        case SPNEGO_NEG_TOKEN_INIT:
                asn1_push_tag(&asn1, ASN1_APPLICATION(0));
-               asn1_write_OID(&asn1, OID_SPNEGO);
+               asn1_write_OID(&asn1, GENSEC_OID_SPNEGO);
                write_negTokenInit(&asn1, &spnego->negTokenInit);
                asn1_pop_tag(&asn1);
                break;
index 7d2b7ad9b8c5c9852838e3450234e24d40e98b6f..39df8fce02212e5e0a29acf3d9653772c3d2444d 100644 (file)
@@ -22,7 +22,6 @@
 #include "includes.h"
 #include "libcli/raw/libcliraw.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 
 #define SETUP_REQUEST_SESSION(cmd, wct, buflen) do { \
        req = smbcli_request_setup_session(session, cmd, wct, buflen); \
@@ -445,10 +444,10 @@ static NTSTATUS smb_raw_session_setup_generic_spnego(struct smbcli_session *sess
        }
 
        if (session->transport->negotiate.secblob.length) {
-               chosen_oid = OID_SPNEGO;
+               chosen_oid = GENSEC_OID_SPNEGO;
        } else {
                /* without a sec blob, means raw NTLMSSP */
-               chosen_oid = OID_NTLMSSP;
+               chosen_oid = GENSEC_OID_NTLMSSP;
        }
 
        status = gensec_start_mech_by_oid(session->gensec, chosen_oid);
index f36528a00a703e42d4c9e3fb185067deb7eb4170..1c2e1ff7f83062aa5a87108e13129c4f36f36602 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "includes.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 #include "smb_server/smb_server.h"
 
 
@@ -325,7 +324,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
                        return;
                }
 
-               nt_status = gensec_start_mech_by_oid(gensec_security, OID_SPNEGO);
+               nt_status = gensec_start_mech_by_oid(gensec_security, GENSEC_OID_SPNEGO);
                
                if (!NT_STATUS_IS_OK(nt_status)) {
                        DEBUG(0, ("Failed to start SPNEGO: %s\n", nt_errstr(nt_status)));
index cc8d4d7ff2eb76b267fbccde0a1802acfd253ebb..453f296c78458c8af4b5f4e84af6b39e60946ac0 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "includes.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 #include "smb_server/smb_server.h"
 
 
@@ -241,7 +240,7 @@ static NTSTATUS sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup
 
                gensec_want_feature(gensec_ctx, GENSEC_WANT_SESSION_KEY);
 
-               status = gensec_start_mech_by_oid(gensec_ctx, OID_SPNEGO);
+               status = gensec_start_mech_by_oid(gensec_ctx, GENSEC_OID_SPNEGO);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC SPNEGO server code: %s\n", nt_errstr(status)));
                        return status;
index 23586b1db598f09fa3f31b07d684164a68ccc528..448559e350fa5371f1a9d99520b08c4b3af91707 100644 (file)
@@ -27,7 +27,6 @@
 #include "system/passwd.h"
 #include "lib/cmdline/popt_common.h"
 #include "auth/auth.h"
-#include "asn_1.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -377,7 +376,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                switch (stdio_helper_mode) {
                case GSS_SPNEGO_CLIENT:
                case GSS_SPNEGO_SERVER:
-                       nt_status = gensec_start_mech_by_oid(*gensec_state, OID_SPNEGO);
+                       nt_status = gensec_start_mech_by_oid(*gensec_state, GENSEC_OID_SPNEGO);
                        if (!in.length) {
                                first = True;
                        }
@@ -387,7 +386,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                                first = True;
                        }
                case SQUID_2_5_NTLMSSP:
-                       nt_status = gensec_start_mech_by_oid(*gensec_state, OID_NTLMSSP);
+                       nt_status = gensec_start_mech_by_oid(*gensec_state, GENSEC_OID_NTLMSSP);
                        break;
                default:
                        abort();