Patch rpc samr "RemoveMemeberForeignDomain" on pre3

Jianliang Lu j.lu at tiesse.com
Thu Nov 27 17:14:29 GMT 2003


This patch will fix the wrong implementation of "RemoveMemeberForeignDomain" 
rpc samr. For this call we should delete alias, not the user account.
You can check this with usrmgr: try delete a user, you can see the rpc smar
"RemoveMemeberForeignDomain" and "deleteuser" are sent to the server, if we
delete the user account within "RemoveMemeberForeignDomain", then the later 
"deleteuser" will got a "USER NOT FOUND" error code.
>From the trace to Microsoft NT I have seen that the correct operation may be
"delete alias" in front of a "RemoveMemeberForeignDomain", but I have not any 
doc
to confirm it.

patch:
--------------------------------------------------------------------
--- rpc_server/srv_samr.c	Thu Nov 27 15:50:25 2003
+++ rpc_server/srv_samr.c.orig	Tue Nov 25 17:01:38 2003
@@ -1348,7 +1348,6 @@
 
 static BOOL api_samr_remove_user_foreign_domain(pipes_struct *p)
 {
-
 	SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN q_u;
 	SAMR_R_REMOVE_USER_FOREIGN_DOMAIN r_u;
 
@@ -1358,22 +1357,19 @@
 	ZERO_STRUCT(q_u);
 	ZERO_STRUCT(r_u);
 
-	if (!samr_io_q_del_aliasmem("", &q_u, data, 0)) {
-		DEBUG(0,("api_samr_del_aliasmem: unable to unmarshall 
SAMR_Q_DEL_ALIASMEM.\n"));
+	if (!samr_io_q_remove_user_foreign_domain("", &q_u, data, 0)) {
+		DEBUG(0,("api_samr_remove_user_foreign_domain: unable to 
unmarshall SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN.\n"));
 		return False;
 	}
 
-	r_u.status = _samr_del_aliasmem(p, &q_u, &r_u);
-	if NT_STATUS_EQUAL(r_u.status, NT_STATUS_NO_SUCH_ALIAS)
-		r_u.status = NT_STATUS_OK;
+	r_u.status = _samr_remove_user_foreign_domain(p, &q_u, &r_u);
 
-	if (!samr_io_r_del_aliasmem("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_samr_del_aliasmem: unable to marshall 
SAMR_R_DEL_ALIASMEM.\n"));
+	if (!samr_io_r_remove_user_foreign_domain("", &r_u, rdata, 0)) {
+		DEBUG(0,("api_samr_remove_user_foreign_domain: unable to 
marshall SAMR_R_REMOVE_USER_FOREIGN_DOMAIN.\n"));
 		return False;
 	}
 
 	return True;
-
 }
--------------------------------------------------------------------

cheers,
Jianliang Lu

TieSse s.p.a.     Ivrea (To) - Italy
j.lu at tiesse.com   luj at libero.it
http://www.tiesse.com



More information about the samba-technical mailing list