r16530: Send monitor messages only after successful receiving result of a stage.
authorRafal Szczesniak <mimir@samba.org>
Mon, 26 Jun 2006 21:17:31 +0000 (21:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:09:33 +0000 (14:09 -0500)
rafal
(This used to be commit e5dc6311633146e44063ba5eb20488468af75914)

source4/libnet/userman.c

index cd12ece0e828c7df4fc6e4c0b82af49d1634c172..08b0a2f1e2ad3c0fe19502b299c392a0e347ae32 100644 (file)
@@ -767,45 +767,53 @@ static void usermod_handler(struct rpc_request *req)
        case USERMOD_LOOKUP:
                c->status = usermod_lookup(c, s);
                
-               /* monitor message */
-               msg.type = rpc_lookup_name;
-               msg_lookup = talloc(s, struct msg_rpc_lookup_name);
-
-               msg_lookup->rid   = s->lookupname.out.rids.ids;
-               msg_lookup->count = s->lookupname.out.rids.count;
-               msg.data = (void*)msg_lookup;
-               msg.data_size = sizeof(*msg_lookup);
+               if (NT_STATUS_IS_OK(c->status)) {
+                       /* monitor message */
+                       msg.type = rpc_lookup_name;
+                       msg_lookup = talloc(s, struct msg_rpc_lookup_name);
+                       
+                       msg_lookup->rid   = s->lookupname.out.rids.ids;
+                       msg_lookup->count = s->lookupname.out.rids.count;
+                       msg.data = (void*)msg_lookup;
+                       msg.data_size = sizeof(*msg_lookup);
+               }
                break;
 
        case USERMOD_OPEN:
                c->status = usermod_open(c, s);
 
-               /* monitor message */
-               msg.type = rpc_open_user;
-               msg_open = talloc(s, struct msg_rpc_open_user);
-
-               msg_open->rid         = s->openuser.in.rid;
-               msg_open->access_mask = s->openuser.in.rid;
-               msg.data = (void*)msg_open;
-               msg.data_size = sizeof(*msg_open);
+               if (NT_STATUS_IS_OK(c->status)) {
+                       /* monitor message */
+                       msg.type = rpc_open_user;
+                       msg_open = talloc(s, struct msg_rpc_open_user);
+                       
+                       msg_open->rid         = s->openuser.in.rid;
+                       msg_open->access_mask = s->openuser.in.rid;
+                       msg.data = (void*)msg_open;
+                       msg.data_size = sizeof(*msg_open);
+               }
                break;
 
        case USERMOD_QUERY:
                c->status = usermod_query(c, s);
 
-               /* monitor message */
-               msg.type = rpc_query_user;
-               msg.data = NULL;
-               msg.data_size = 0;
+               if (NT_STATUS_IS_OK(c->status)) {
+                       /* monitor message */
+                       msg.type = rpc_query_user;
+                       msg.data = NULL;
+                       msg.data_size = 0;
+               }
                break;
 
        case USERMOD_MODIFY:
                c->status = usermod_modify(c, s);
-
-               /* monitor message */
-               msg.type = rpc_set_user;
-               msg.data = NULL;
-               msg.data_size = 0;
+               
+               if (NT_STATUS_IS_OK(c->status)) {
+                       /* monitor message */
+                       msg.type = rpc_set_user;
+                       msg.data = NULL;
+                       msg.data_size = 0;
+               }
                break;
        }