Fixed a crash bug in unixuid module on failed ID mapping
authorAndrew Tridgell <tridge@samba.org>
Fri, 11 Apr 2008 04:12:34 +0000 (14:12 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 11 Apr 2008 04:12:34 +0000 (14:12 +1000)
We need to intialise *ids regardless of the status of the call, as the
IDL specifies that the out[] array always exists. If we don't
initialise out then we get a segv when a id mapping fails.

This still doesn't explain why the idmapping is failing, but at least
the client now gets NT_STATUS_NONE_MAPPED rather than a crashed
server.
(This used to be commit 4449ce381aca25e7f510a2f24b43c3a81e870032)

source4/winbind/wb_sids2xids.c
source4/winbind/wb_xids2sids.c

index 302b915ff5b13518dfa96ed6c37defb7cc732fd4..6b89caf4657fc1cf6757669c16f4a94ed5cf4b5b 100644 (file)
@@ -67,15 +67,13 @@ NTSTATUS wb_sids2xids_recv(struct composite_context *ctx,
                           struct id_mapping **ids)
 {
        NTSTATUS status = composite_wait(ctx);
+       struct sids2xids_state *state = talloc_get_type(ctx->private_data,
+                                                       struct sids2xids_state);
 
        DEBUG(5, ("wb_sids2xids_recv called\n"));
 
-       if (NT_STATUS_IS_OK(status)) {
-               struct sids2xids_state *state =
-                       talloc_get_type(ctx->private_data,
-                               struct sids2xids_state);
-               *ids = state->ids;
-       }
+       *ids = state->ids;
+
        talloc_free(ctx);
        return status;
 }
index 1be394d276a2d8f329ed1639e7e077f3ee1ca37e..a1cf2667ff2baa43e18732324f85798278a2c06e 100644 (file)
@@ -67,15 +67,13 @@ NTSTATUS wb_xids2sids_recv(struct composite_context *ctx,
                           struct id_mapping **ids)
 {
        NTSTATUS status = composite_wait(ctx);
+       struct xids2sids_state *state = talloc_get_type(ctx->private_data,
+                                                       struct xids2sids_state);
 
        DEBUG(5, ("wb_xids2sids_recv called.\n"));
 
-       if (NT_STATUS_IS_OK(status)) {
-               struct xids2sids_state *state =
-                       talloc_get_type(ctx->private_data,
-                               struct xids2sids_state);
-               *ids = state->ids;
-       }
+       *ids = state->ids;
+
        talloc_free(ctx);
        return status;
 }