[SCM] Samba Shared Repository - branch master updated - c0cf457c85a1fb89d72c2088c103a51af9341de4

Günther Deschner gd at samba.org
Wed Oct 22 19:38:35 GMT 2008


The branch, master has been updated
       via  c0cf457c85a1fb89d72c2088c103a51af9341de4 (commit)
       via  527d79747642cf83c89a8931e4fe86df1fec454b (commit)
       via  d9f1fff5b35a2c852e69c2c58e68824b5f381d01 (commit)
       via  cef97c245955d0f125928740cd89984100635d29 (commit)
       via  5d805425b9382e3aabda4218ffa68584a2a58c9f (commit)
       via  d81a9a9837870f0581269c27e41257133d24fbf6 (commit)
      from  6c019b875515662f5c97d89d653e2708478581ad (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c0cf457c85a1fb89d72c2088c103a51af9341de4
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 22 19:23:49 2008 +0200

    s3-asn1: make all of s3 asn1 code do a proper asn1_init() first.
    
    Guenther

commit 527d79747642cf83c89a8931e4fe86df1fec454b
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 22 18:57:59 2008 +0200

    s3-asn1/spnego: use OIDs including dots.
    
    Guenther

commit d9f1fff5b35a2c852e69c2c58e68824b5f381d01
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 22 14:06:08 2008 +0200

    s3: use shared asn1 code.
    
    Guenther

commit cef97c245955d0f125928740cd89984100635d29
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 22 14:01:53 2008 +0200

    s3-spnego: move spnego defines to spnego.h
    
    Guenther

commit 5d805425b9382e3aabda4218ffa68584a2a58c9f
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 22 14:03:43 2008 +0200

    lib-util: merge from s3 asn1.
    
    Guenther

commit d81a9a9837870f0581269c27e41257133d24fbf6
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 22 14:02:31 2008 +0200

    lib-util: fix c++ compile warning.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 lib/util/asn1.c               |    2 +-
 lib/util/asn1.h               |    3 +
 source3/Makefile.in           |    8 +-
 source3/include/asn_1.h       |   71 -----
 source3/include/includes.h    |    3 +-
 source3/include/proto.h       |   33 +---
 source3/include/spnego.h      |   17 ++
 source3/libads/cldap.c        |  147 ++++++-----
 source3/libads/krb5_setpw.c   |   59 ++--
 source3/libads/sasl.c         |    6 +-
 source3/libsmb/asn1.c         |  603 -----------------------------------------
 source3/libsmb/cliconnect.c   |   15 +-
 source3/libsmb/clikrb5.c      |   62 +++--
 source3/libsmb/clispnego.c    |  543 ++++++++++++++++++++-----------------
 source3/libsmb/spnego.c       |   82 +++---
 source3/rpc_server/srv_pipe.c |    2 +-
 source3/smbd/sesssetup.c      |   31 ++-
 source3/torture/t_asn1.c      |   22 +-
 18 files changed, 556 insertions(+), 1153 deletions(-)
 delete mode 100644 source3/include/asn_1.h
 delete mode 100644 source3/libsmb/asn1.c


Changeset truncated at 500 lines:

diff --git a/lib/util/asn1.c b/lib/util/asn1.c
index ef34654..a2665ed 100644
--- a/lib/util/asn1.c
+++ b/lib/util/asn1.c
@@ -355,7 +355,7 @@ bool asn1_check_BOOLEAN(struct asn1_data *data, bool v)
 bool asn1_load(struct asn1_data *data, DATA_BLOB blob)
 {
 	ZERO_STRUCTP(data);
-	data->data = talloc_memdup(data, blob.data, blob.length);
+	data->data = (uint8_t *)talloc_memdup(data, blob.data, blob.length);
 	if (!data->data) {
 		data->has_error = true;
 		return false;
diff --git a/lib/util/asn1.h b/lib/util/asn1.h
index c8e83b9..5041938 100644
--- a/lib/util/asn1.h
+++ b/lib/util/asn1.h
@@ -34,6 +34,8 @@ struct asn1_data {
 	bool has_error;
 };
 
+typedef struct asn1_data ASN1_DATA;
+
 #define ASN1_APPLICATION(x) ((x)+0x60)
 #define ASN1_APPLICATION_SIMPLE(x) ((x)+0x40)
 #define ASN1_SEQUENCE(x) ((x)+0x30)
@@ -44,6 +46,7 @@ struct asn1_data {
 #define ASN1_OID 0x6
 #define ASN1_BOOLEAN 0x1
 #define ASN1_INTEGER 0x2
+#define ASN1_BITFIELD 0x3
 #define ASN1_ENUMERATED 0xa
 #define ASN1_SET 0x31
 
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 25c3a59..eee03db 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -425,7 +425,7 @@ LIBSAMBA_OBJ = $(LIBSMB_OBJ0) \
 CLDAP_OBJ = libads/cldap.o
 
 LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
-	     libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \
+	     libsmb/clikrb5.o libsmb/clispnego.o ../lib/util/asn1.o \
 	     libsmb/clirap.o libsmb/clierror.o libsmb/climessage.o \
 	     libsmb/clireadwrite.o libsmb/clilist.o libsmb/cliprint.o \
 	     libsmb/clitrans.o libsmb/clisecdesc.o libsmb/clidgram.o \
@@ -772,7 +772,7 @@ SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
 PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \
 		$(LIBSAMBA_OBJ) \
 		$(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \
-		$(POPT_LIB_OBJ) $(SMBLDAP_OBJ) libsmb/asn1.o \
+		$(POPT_LIB_OBJ) $(SMBLDAP_OBJ) ../lib/util/asn1.o \
 		$(LDB_OBJ)
 
 SMBGET_OBJ = utils/smbget.o $(POPT_LIB_OBJ) $(LIBSMBCLIENT_OBJ1) @LIBWBCLIENT_STATIC@
@@ -988,7 +988,7 @@ NDRDUMP_OBJ = ../librpc/tools/ndrdump.o \
 	      librpc/gen_ndr/ndr_svcctl.o \
 		  librpc/gen_ndr/tables.o ../librpc/ndr/ndr_table.o \
 	      ../librpc/ndr/ndr_krb5pac.o \
-		  librpc/gen_ndr/ndr_krb5pac.o libsmb/asn1.o
+		  librpc/gen_ndr/ndr_krb5pac.o ../lib/util/asn1.o
 
 DEBUG2HTML_OBJ = utils/debug2html.o utils/debugparse.o
 
@@ -1121,7 +1121,7 @@ TDBTORTURE_OBJ = @tdbdir@/tools/tdbtorture.o @LIBTDB_STATIC@ $(LIBREPLACE_OBJ) \
 NTLM_AUTH_OBJ1 = utils/ntlm_auth.o utils/ntlm_auth_diagnostics.o
 
 NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \
-		libsmb/asn1.o libsmb/spnego.o libsmb/clikrb5.o libads/kerberos.o \
+		../lib/util/asn1.o libsmb/spnego.o libsmb/clikrb5.o libads/kerberos.o \
 		$(SERVER_MUTEX_OBJ) $(LIBADS_SERVER_OBJ) \
 		$(PASSDB_OBJ) $(GROUPDB_OBJ) \
 		$(SMBLDAP_OBJ) $(LIBNMB_OBJ) \
diff --git a/source3/include/asn_1.h b/source3/include/asn_1.h
deleted file mode 100644
index dd345cd..0000000
--- a/source3/include/asn_1.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.   
-   simple ASN1 code
-   Copyright (C) Andrew Tridgell 2001
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _ASN_1_H
-#define _ASN_1_H
-
-struct nesting {
-	off_t start;
-	size_t taglen; /* for parsing */
-	struct nesting *next;
-};
-
-typedef struct asn1_data {
-	uint8 *data;
-	size_t length;
-	off_t ofs;
-	struct nesting *nesting;
-	bool has_error;
-} ASN1_DATA;
-
-
-#define ASN1_APPLICATION(x) ((x)+0x60)
-#define ASN1_APPLICATION_SIMPLE(x) ((x)+0x40)
-#define ASN1_SEQUENCE(x) ((x)+0x30)
-#define ASN1_CONTEXT(x) ((x)+0xa0)
-#define ASN1_CONTEXT_SIMPLE(x) ((x)+0x80)
-#define ASN1_GENERAL_STRING 0x1b
-#define ASN1_OCTET_STRING 0x4
-#define ASN1_OID 0x6
-#define ASN1_BOOLEAN 0x1
-#define ASN1_INTEGER 0x2
-#define ASN1_BITFIELD 0x3
-#define ASN1_ENUMERATED 0xa
-#define ASN1_SET 0x31
-
-#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	(uchar*)"\x01\x00"
-#define TOK_ID_KRB_AP_REP	(uchar*)"\x02\x00"
-#define TOK_ID_KRB_ERROR	(uchar*)"\x03\x00"
-#define TOK_ID_GSS_GETMIC	(uchar*)"\x01\x01"
-#define TOK_ID_GSS_WRAP		(uchar*)"\x02\x01"
-
-#endif /* _ASN_1_H */
diff --git a/source3/include/includes.h b/source3/include/includes.h
index c164d28..7162357 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -584,6 +584,8 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 
 #include "../lib/util/data_blob.h"
 #include "../lib/util/time.h"
+#include "../lib/util/asn1.h"
+
 /* And a little extension. Abort on type mismatch */
 #define talloc_get_type_abort(ptr, type) \
 	(type *)talloc_check_name_abort(ptr, #type)
@@ -643,7 +645,6 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 #include "client.h"
 
 #include "session.h"
-#include "asn_1.h"
 #include "popt.h"
 #include "mangle.h"
 #include "module.h"
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9b555e6..370a641 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2474,37 +2474,6 @@ _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe
 				      struct cli_credentials *credentials, struct event_context *ev, 
 				      struct loadparm_context *lp_ctx);
 
-/* The following definitions come from libsmb/asn1.c  */
-
-void asn1_free(ASN1_DATA *data);
-bool asn1_write(ASN1_DATA *data, const void *p, int len);
-bool asn1_write_uint8(ASN1_DATA *data, uint8 v);
-bool asn1_push_tag(ASN1_DATA *data, uint8 tag);
-bool asn1_pop_tag(ASN1_DATA *data);
-bool asn1_write_Integer(ASN1_DATA *data, int i);
-bool asn1_write_OID(ASN1_DATA *data, const char *OID);
-bool asn1_write_OctetString(ASN1_DATA *data, const void *p, size_t length);
-bool asn1_write_GeneralString(ASN1_DATA *data, const char *s);
-bool asn1_write_BOOLEAN(ASN1_DATA *data, bool v);
-bool asn1_write_BOOLEAN2(ASN1_DATA *data, bool v);
-bool asn1_check_BOOLEAN(ASN1_DATA *data, bool v);
-bool asn1_load(ASN1_DATA *data, DATA_BLOB blob);
-bool asn1_read(ASN1_DATA *data, void *p, int len);
-bool asn1_read_uint8(ASN1_DATA *data, uint8 *v);
-bool asn1_check_tag(ASN1_DATA *data, uint8 tag);
-bool asn1_start_tag(ASN1_DATA *data, uint8 tag);
-bool asn1_end_tag(ASN1_DATA *data);
-int asn1_tag_remaining(ASN1_DATA *data);
-bool asn1_read_OID(ASN1_DATA *data, char **OID);
-bool asn1_check_OID(ASN1_DATA *data, const char *OID);
-bool asn1_read_GeneralString(ASN1_DATA *data, char **s);
-bool asn1_read_OctetString(ASN1_DATA *data, DATA_BLOB *blob);
-bool asn1_read_Integer(ASN1_DATA *data, int *i);
-bool asn1_check_enumerated(ASN1_DATA *data, int v);
-bool asn1_write_enumerated(ASN1_DATA *data, uint8 v);
-bool ber_write_OID_String(DATA_BLOB *blob, const char *OID);
-bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID);
-
 /* The following definitions come from libsmb/cliconnect.c  */
 
 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, 
@@ -2966,7 +2935,7 @@ DATA_BLOB spnego_gen_negTokenInit(char guid[16],
 				  const char *principal);
 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
 bool spnego_parse_negTokenInit(DATA_BLOB blob,
-			       char *OIDs[ASN1_MAX_OIDS], 
+			       char *OIDs[ASN1_MAX_OIDS],
 			       char **principal);
 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
diff --git a/source3/include/spnego.h b/source3/include/spnego.h
index 02921ed..f777969 100644
--- a/source3/include/spnego.h
+++ b/source3/include/spnego.h
@@ -35,6 +35,23 @@
 #define SPNEGO_NEG_TOKEN_INIT 0
 #define SPNEGO_NEG_TOKEN_TARG 1
 
+/* 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	(uchar*)"\x01\x00"
+#define TOK_ID_KRB_AP_REP	(uchar*)"\x02\x00"
+#define TOK_ID_KRB_ERROR	(uchar*)"\x03\x00"
+#define TOK_ID_GSS_GETMIC	(uchar*)"\x01\x01"
+#define TOK_ID_GSS_WRAP		(uchar*)"\x02\x01"
+
 typedef enum _spnego_negResult {
 	SPNEGO_ACCEPT_COMPLETED = 0,
 	SPNEGO_ACCEPT_INCOMPLETE = 1,
diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c
index c37220c..8f9a8ff 100644
--- a/source3/libads/cldap.c
+++ b/source3/libads/cldap.c
@@ -24,10 +24,10 @@
 /*
   do a cldap netlogon query
 */
-static int send_cldap_netlogon(int sock, const char *domain, 
+static int send_cldap_netlogon(TALLOC_CTX *mem_ctx, int sock, const char *domain,
 			       const char *hostname, unsigned ntversion)
 {
-	ASN1_DATA data;
+	ASN1_DATA *data;
 	char ntver[4];
 #ifdef CLDAP_USER_QUERY
 	char aac[4];
@@ -36,69 +36,72 @@ static int send_cldap_netlogon(int sock, const char *domain,
 #endif
 	SIVAL(ntver, 0, ntversion);
 
-	memset(&data, 0, sizeof(data));
+	data = asn1_init(mem_ctx);
+	if (data == NULL) {
+		return -1;
+	}
 
-	asn1_push_tag(&data,ASN1_SEQUENCE(0));
-	asn1_write_Integer(&data, 4);
-	asn1_push_tag(&data, ASN1_APPLICATION(3));
-	asn1_write_OctetString(&data, NULL, 0);
-	asn1_write_enumerated(&data, 0);
-	asn1_write_enumerated(&data, 0);
-	asn1_write_Integer(&data, 0);
-	asn1_write_Integer(&data, 0);
-	asn1_write_BOOLEAN2(&data, False);
-	asn1_push_tag(&data, ASN1_CONTEXT(0));
+	asn1_push_tag(data,ASN1_SEQUENCE(0));
+	asn1_write_Integer(data, 4);
+	asn1_push_tag(data, ASN1_APPLICATION(3));
+	asn1_write_OctetString(data, NULL, 0);
+	asn1_write_enumerated(data, 0);
+	asn1_write_enumerated(data, 0);
+	asn1_write_Integer(data, 0);
+	asn1_write_Integer(data, 0);
+	asn1_write_BOOLEAN(data, False);
+	asn1_push_tag(data, ASN1_CONTEXT(0));
 
 	if (domain) {
-		asn1_push_tag(&data, ASN1_CONTEXT(3));
-		asn1_write_OctetString(&data, "DnsDomain", 9);
-		asn1_write_OctetString(&data, domain, strlen(domain));
-		asn1_pop_tag(&data);
+		asn1_push_tag(data, ASN1_CONTEXT(3));
+		asn1_write_OctetString(data, "DnsDomain", 9);
+		asn1_write_OctetString(data, domain, strlen(domain));
+		asn1_pop_tag(data);
 	}
 
-	asn1_push_tag(&data, ASN1_CONTEXT(3));
-	asn1_write_OctetString(&data, "Host", 4);
-	asn1_write_OctetString(&data, hostname, strlen(hostname));
-	asn1_pop_tag(&data);
+	asn1_push_tag(data, ASN1_CONTEXT(3));
+	asn1_write_OctetString(data, "Host", 4);
+	asn1_write_OctetString(data, hostname, strlen(hostname));
+	asn1_pop_tag(data);
 
 #ifdef CLDAP_USER_QUERY
-	asn1_push_tag(&data, ASN1_CONTEXT(3));
-	asn1_write_OctetString(&data, "User", 4);
-	asn1_write_OctetString(&data, "SAMBA$", 6);
-	asn1_pop_tag(&data);
-
-	asn1_push_tag(&data, ASN1_CONTEXT(3));
-	asn1_write_OctetString(&data, "AAC", 4);
-	asn1_write_OctetString(&data, aac, 4);
-	asn1_pop_tag(&data);
+	asn1_push_tag(data, ASN1_CONTEXT(3));
+	asn1_write_OctetString(data, "User", 4);
+	asn1_write_OctetString(data, "SAMBA$", 6);
+	asn1_pop_tag(data);
+
+	asn1_push_tag(data, ASN1_CONTEXT(3));
+	asn1_write_OctetString(data, "AAC", 4);
+	asn1_write_OctetString(data, aac, 4);
+	asn1_pop_tag(data);
 #endif
 
-	asn1_push_tag(&data, ASN1_CONTEXT(3));
-	asn1_write_OctetString(&data, "NtVer", 5);
-	asn1_write_OctetString(&data, ntver, 4);
-	asn1_pop_tag(&data);
+	asn1_push_tag(data, ASN1_CONTEXT(3));
+	asn1_write_OctetString(data, "NtVer", 5);
+	asn1_write_OctetString(data, ntver, 4);
+	asn1_pop_tag(data);
 
-	asn1_pop_tag(&data);
+	asn1_pop_tag(data);
 
-	asn1_push_tag(&data,ASN1_SEQUENCE(0));
-	asn1_write_OctetString(&data, "NetLogon", 8);
-	asn1_pop_tag(&data);
-	asn1_pop_tag(&data);
-	asn1_pop_tag(&data);
+	asn1_push_tag(data,ASN1_SEQUENCE(0));
+	asn1_write_OctetString(data, "NetLogon", 8);
+	asn1_pop_tag(data);
+	asn1_pop_tag(data);
+	asn1_pop_tag(data);
 
-	if (data.has_error) {
-		DEBUG(2,("Failed to build cldap netlogon at offset %d\n", (int)data.ofs));
-		asn1_free(&data);
+	if (data->has_error) {
+		DEBUG(2,("Failed to build cldap netlogon at offset %d\n", (int)data->ofs));
+		asn1_free(data);
 		return -1;
 	}
 
-	if (write(sock, data.data, data.length) != (ssize_t)data.length) {
+	if (write(sock, data->data, data->length) != (ssize_t)data->length) {
 		DEBUG(2,("failed to send cldap query (%s)\n", strerror(errno)));
-		asn1_free(&data);
+		asn1_free(data);
 		return -1;
 	}
 
-	asn1_free(&data);
+	asn1_free(data);
 
 	return 0;
 }
@@ -123,7 +126,7 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
 			       struct netlogon_samlogon_response **reply)
 {
 	int ret;
-	ASN1_DATA data;
+	ASN1_DATA *data;
 	DATA_BLOB blob = data_blob_null;
 	DATA_BLOB os1 = data_blob_null;
 	DATA_BLOB os2 = data_blob_null;
@@ -160,28 +163,34 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
 	}
 	blob.length = ret;
 
-	asn1_load(&data, blob);
-	asn1_start_tag(&data, ASN1_SEQUENCE(0));
-	asn1_read_Integer(&data, &i1);
-	asn1_start_tag(&data, ASN1_APPLICATION(4));
-	asn1_read_OctetString(&data, &os1);
-	asn1_start_tag(&data, ASN1_SEQUENCE(0));
-	asn1_start_tag(&data, ASN1_SEQUENCE(0));
-	asn1_read_OctetString(&data, &os2);
-	asn1_start_tag(&data, ASN1_SET);
-	asn1_read_OctetString(&data, &os3);
-	asn1_end_tag(&data);
-	asn1_end_tag(&data);
-	asn1_end_tag(&data);
-	asn1_end_tag(&data);
-	asn1_end_tag(&data);
-
-	if (data.has_error) {
+	data = asn1_init(mem_ctx);
+	if (data == NULL) {
+		data_blob_free(&blob);
+		return -1;
+	}
+
+	asn1_load(data, blob);
+	asn1_start_tag(data, ASN1_SEQUENCE(0));
+	asn1_read_Integer(data, &i1);
+	asn1_start_tag(data, ASN1_APPLICATION(4));
+	asn1_read_OctetString(data, NULL, &os1);
+	asn1_start_tag(data, ASN1_SEQUENCE(0));
+	asn1_start_tag(data, ASN1_SEQUENCE(0));
+	asn1_read_OctetString(data, NULL, &os2);
+	asn1_start_tag(data, ASN1_SET);
+	asn1_read_OctetString(data, NULL, &os3);
+	asn1_end_tag(data);
+	asn1_end_tag(data);
+	asn1_end_tag(data);
+	asn1_end_tag(data);
+	asn1_end_tag(data);
+
+	if (data->has_error) {
 		data_blob_free(&blob);
 		data_blob_free(&os1);
 		data_blob_free(&os2);
 		data_blob_free(&os3);
-		asn1_free(&data);
+		asn1_free(data);
 		DEBUG(1,("Failed to parse cldap reply\n"));
 		return -1;
 	}
@@ -193,6 +202,7 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
 		data_blob_free(&os2);
 		data_blob_free(&os3);
 		data_blob_free(&blob);
+		asn1_free(data);
 		return -1;
 	}
 
@@ -202,6 +212,7 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
 		data_blob_free(&os2);
 		data_blob_free(&os3);
 		data_blob_free(&blob);
+		asn1_free(data);
 		TALLOC_FREE(r);
 		return -1;
 	}
@@ -212,8 +223,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
 	data_blob_free(&os2);
 	data_blob_free(&os3);
 	data_blob_free(&blob);
-	
-	asn1_free(&data);
+
+	asn1_free(data);
 
 	if (reply) {
 		*reply = r;
@@ -244,7 +255,7 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
 		return False;
 	}
 
-	ret = send_cldap_netlogon(sock, realm, global_myname(), nt_version);
+	ret = send_cldap_netlogon(mem_ctx, sock, realm, global_myname(), nt_version);
 	if (ret != 0) {
 		close(sock);
 		return False;
diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c
index 0ff9f2b..04ee6ee 100644
--- a/source3/libads/krb5_setpw.c
+++ b/source3/libads/krb5_setpw.c
@@ -65,7 +65,7 @@ static DATA_BLOB encode_krb5_setpw(const char *principal, const char *password)
 	char* c;
 	char* princ;
 
-	ASN1_DATA req;
+	ASN1_DATA *req;
 	DATA_BLOB ret;
 
 
@@ -90,40 +90,43 @@ static DATA_BLOB encode_krb5_setpw(const char *principal, const char *password)
 		return data_blob_null;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list