winbind: Fix a type error
authorVolker Lendecke <vl@samba.org>
Tue, 2 Feb 2016 13:41:16 +0000 (14:41 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 16 Feb 2016 09:50:10 +0000 (10:50 +0100)
nss_info_methods has "get_nss_info"'s p_gid parameter as
gid_t *, not uint32_t *. Probably that did not hurt due to
typedefs, but if we find a platform where gid_t is not
uint32_t, this would be VERY hard to debug

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/idmap_ad.c

index bc9d785bb417e5f04030982c5da597920ab16d68..df1d3695ebb2dc84456b450ab5b192a76a56198b 100644 (file)
@@ -672,7 +672,7 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
                                  const char **homedir,
                                  const char **shell,
                                  const char **gecos,
-                                 uint32_t *gid )
+                                 gid_t *p_gid )
 {
        const char *attrs[] = {NULL, /* attr_homedir */
                               NULL, /* attr_shell */
@@ -741,9 +741,18 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
        *shell   = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_shell_attr);
        *gecos   = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_gecos_attr);
 
-       if (gid) {
-               if (!ads_pull_uint32(ctx->ads, msg_internal, ctx->ad_schema->posix_gidnumber_attr, gid))
-                       *gid = (uint32_t)-1;
+       if (p_gid != NULL) {
+               uint32_t gid = UINT32_MAX;
+               bool ok;
+
+               ok = ads_pull_uint32(ctx->ads, msg_internal,
+                                    ctx->ad_schema->posix_gidnumber_attr,
+                                    &gid);
+               if (ok) {
+                       *p_gid = gid;
+               } else {
+                       *p_gid = (gid_t)-1;
+               }
        }
 
        nt_status = NT_STATUS_OK;