[PATCH] set VUID smb_name for Kerberos clients

Luke Howard lukeh at PADL.COM
Wed Jan 7 08:30:59 GMT 2004


SAMBA 3.0.1 regressed in passing the smb_name to register_vuid()
from reply_spnego_kerberos(). The problem was introduced by
freeing (and setting to NULL) the user name before register_vuid()
was called. Also, smb_name should be unqualified; this is fixed
also in the attached patch.

-- Luke

-------------- next part --------------
Index: smbd/sesssetup.c
===================================================================
RCS file: /home/project/cvs/samba/source/smbd/sesssetup.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 sesssetup.c
--- smbd/sesssetup.c	2004/01/07 06:37:18	1.1.1.7
+++ smbd/sesssetup.c	2004/01/07 08:18:43
@@ -146,7 +146,7 @@
 	char *user;
 	int sess_vuid;
 	NTSTATUS ret;
-	DATA_BLOB auth_data;
+	DATA_BLOB auth_data = data_blob(NULL, 0);
 	DATA_BLOB ap_rep, ap_rep_wrapped, response;
 	auth_serversupplied_info *server_info = NULL;
 	DATA_BLOB session_key;
@@ -203,11 +203,10 @@
 	
 	pw = smb_getpwnam( user );
 	
-	SAFE_FREE(user);
-	SAFE_FREE(client);
-
 	if (!pw) {
 		DEBUG(1,("Username %s is invalid on this system\n",user));
+		SAFE_FREE(user);
+		SAFE_FREE(client);
 		data_blob_free(&ap_rep);
 		return ERROR_NT(NT_STATUS_LOGON_FAILURE);
 	}
@@ -219,14 +218,17 @@
 	
 	if (!NT_STATUS_IS_OK(ret = make_server_info_pw(&server_info,pw))) {
 		DEBUG(1,("make_server_info_from_pw failed!\n"));
+		SAFE_FREE(user);
+		SAFE_FREE(client);
 		data_blob_free(&ap_rep);
 		return ERROR_NT(ret);
 	}
 
 	/* register_vuid keeps the server info */
-	sess_vuid = register_vuid(server_info, session_key, nullblob, user);
+	sess_vuid = register_vuid(server_info, session_key, nullblob, client);
 
-	free(user);
+	SAFE_FREE(user);
+	SAFE_FREE(client);
 
 	if (sess_vuid == -1) {
 		ret = NT_STATUS_LOGON_FAILURE;


More information about the samba-technical mailing list