[patch] usrmgr and trust relationships

Richard Renard rrenard at idealx.com
Mon Aug 30 20:55:45 GMT 2004


Hi list,

When enumerating trust relationships in usrmgr the account names should
not be null terminated, otherwise it is not possible to delete the trust
relation.

Here is a fix that corrects the behavior.


Richard.

-- 
Richard Renard
rrenard at idealx.com
-------------- next part --------------
--- srv_samr_nt.c.orig	2004-08-30 22:40:40.000000000 +0200
+++ srv_samr_nt.c	2004-08-30 23:08:08.000000000 +0200
@@ -728,7 +728,17 @@
 	for (i = 0; i < num_entries; i++) {
 		pwd = &disp_user_info[i+start_idx];
 		temp_name = pdb_get_username(pwd);
-		init_unistr2(&uni_temp_name, temp_name, UNI_STR_TERMINATE);
+		
+		/*
+		 * usrmgr expects a non-NULL terminated string with 
+		 * trust relationships
+		 */
+		if (pdb_get_acct_ctrl(pwd) & ACB_DOMTRUST) {
+			init_unistr2(&uni_temp_name, temp_name, UNI_FLAGS_NONE);
+		} else {
+			init_unistr2(&uni_temp_name, temp_name, UNI_STR_TERMINATE);
+		}
+
 		user_sid = pdb_get_user_sid(pwd);
 
 		if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) {


More information about the samba-technical mailing list