pam_winbind: fix what data we put into the blobs.
[kai/samba.git] / source3 / nsswitch / pam_winbind.c
index 1c927259e529cffe80660d204d2b845956c49281..0c861e9f976f814483aad51269a821f76c6a17e4 100644 (file)
@@ -1615,14 +1615,16 @@ static int winbind_auth_request(struct pwb_context *ctx,
        logon.username                  = user;
        logon.password                  = pass;
 
-       wbc_status = wbcAddNamedBlob(&logon.num_blobs,
-                                    &logon.blobs,
-                                    "krb5_cc_type",
-                                    0,
-                                    (uint8_t *)cctype,
-                                    strlen(cctype)+1);
-       if (!WBC_ERROR_IS_OK(wbc_status)) {
-               goto done;
+       if (cctype) {
+               wbc_status = wbcAddNamedBlob(&logon.num_blobs,
+                                            &logon.blobs,
+                                            "krb5_cc_type",
+                                            0,
+                                            (uint8_t *)cctype,
+                                            strlen(cctype)+1);
+               if (!WBC_ERROR_IS_OK(wbc_status)) {
+                       goto done;
+               }
        }
 
        wbc_status = wbcAddNamedBlob(&logon.num_blobs,
@@ -1645,14 +1647,16 @@ static int winbind_auth_request(struct pwb_context *ctx,
                goto done;
        }
 
-       wbc_status = wbcAddNamedBlob(&logon.num_blobs,
-                                    &logon.blobs,
-                                    "membership_of",
-                                    0,
-                                    (uint8_t *)membership_of,
-                                    sizeof(membership_of));
-       if (!WBC_ERROR_IS_OK(wbc_status)) {
-               goto done;
+       if (member) {
+               wbc_status = wbcAddNamedBlob(&logon.num_blobs,
+                                            &logon.blobs,
+                                            "membership_of",
+                                            0,
+                                            (uint8_t *)membership_of,
+                                            sizeof(membership_of));
+               if (!WBC_ERROR_IS_OK(wbc_status)) {
+                       goto done;
+               }
        }
 
        wbc_status = wbcLogonUser(&logon, &info, &error, &policy);