s3: Fix malformed require_membership_of_sid.
authorBo Yang <boyang@samba.org>
Sun, 7 Feb 2010 06:45:42 +0000 (14:45 +0800)
committerBo Yang <boyang@samba.org>
Sun, 7 Feb 2010 06:55:25 +0000 (14:55 +0800)
Signed-off-by: Bo Yang <boyang@samba.org>
nsswitch/pam_winbind.c

index 51346a86706139fe5db9cd3568729225026e2a6f..52a8daa1e7c77123d91d5b9bcf7b0427d19567bd 100644 (file)
@@ -1137,6 +1137,7 @@ static bool winbind_name_list_to_sid_string_list(struct pwb_context *ctx,
        char *current_name = NULL;
        const char *search_location;
        const char *comma;
        char *current_name = NULL;
        const char *search_location;
        const char *comma;
+       int len;
 
        if (sid_list_buffer_size > 0) {
                sid_list_buffer[0] = 0;
 
        if (sid_list_buffer_size > 0) {
                sid_list_buffer[0] = 0;
@@ -1192,6 +1193,17 @@ static bool winbind_name_list_to_sid_string_list(struct pwb_context *ctx,
                _make_remark_format(ctx, PAM_TEXT_INFO, _("Cannot convert group %s "
                                "to sid, please contact your administrator to see "
                                "if group %s is valid."), search_location, search_location);
                _make_remark_format(ctx, PAM_TEXT_INFO, _("Cannot convert group %s "
                                "to sid, please contact your administrator to see "
                                "if group %s is valid."), search_location, search_location);
+               /*
+                * The lookup of the last name failed..
+                * It results in require_member_of_sid ends with ','
+                * It is malformated parameter here, overwrite the last ','.
+                */
+               len = strlen(sid_list_buffer);
+               if (len) {
+                       if (sid_list_buffer[len - 1] == ',') {
+                               sid_list_buffer[len - 1] = '\0';
+                       }
+               }
        }
 
        result = true;
        }
 
        result = true;