Use ldb_dn_from_ldb_val() to create a DN in the SAMR server
authorAndrew Bartlett <abartlet@samba.org>
Tue, 4 Nov 2008 04:48:10 +0000 (15:48 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 4 Nov 2008 05:06:57 +0000 (16:06 +1100)
The previous code incorrectly cast an ldb_val into a char *.

Andrew Bartlett

source4/rpc_server/samr/dcesrv_samr.c

index fc2d623160dea81879a3e37ff6b10c7b515ab34f..b3118d772dc184f965eccc7bb52d0d73986251ed 100644 (file)
@@ -2824,8 +2824,13 @@ static NTSTATUS dcesrv_samr_GetMembersInAlias(struct dcesrv_call_state *dce_call
        ret = gendb_search_dn(d_state->sam_ctx, mem_ctx,
                              a_state->account_dn, &msgs, attrs);
 
        ret = gendb_search_dn(d_state->sam_ctx, mem_ctx,
                              a_state->account_dn, &msgs, attrs);
 
-       if (ret != 1)
+       if (ret == -1) {
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
+       } else if (ret == 0) {
+               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+       } else if (ret != 1) {
+               return NT_STATUS_INTERNAL_DB_CORRUPTION;
+       }
 
        r->out.sids->num_sids = 0;
        r->out.sids->sids = NULL;
 
        r->out.sids->num_sids = 0;
        r->out.sids->sids = NULL;
@@ -2845,7 +2850,7 @@ static NTSTATUS dcesrv_samr_GetMembersInAlias(struct dcesrv_call_state *dce_call
                        struct ldb_message **msgs2;
                        const char * const attrs2[2] = { "objectSid", NULL };
                        ret = gendb_search_dn(a_state->sam_ctx, mem_ctx,
                        struct ldb_message **msgs2;
                        const char * const attrs2[2] = { "objectSid", NULL };
                        ret = gendb_search_dn(a_state->sam_ctx, mem_ctx,
-                                             ldb_dn_new(mem_ctx, a_state->sam_ctx, &el->values[i]),
+                                             ldb_dn_from_ldb_val(mem_ctx, a_state->sam_ctx, &el->values[i]),
                                              &msgs2, attrs2);
                        if (ret != 1)
                                return NT_STATUS_INTERNAL_DB_CORRUPTION;
                                              &msgs2, attrs2);
                        if (ret != 1)
                                return NT_STATUS_INTERNAL_DB_CORRUPTION;