Author: gd
Date: 2007-01-25 15:05:23 +0000 (Thu, 25 Jan 2007)
New Revision: 21020

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21020

Log:
Some pam_winbind fixes:
* make debug_state also configurable from the config file
* minor code cleanup

Guenther

Modified:
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.c    2007-01-25 15:00:41 UTC 
(rev 21019)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.c    2007-01-25 15:05:23 UTC 
(rev 21020)
@@ -73,9 +73,9 @@
 }
 #endif /* HAVE_PAM_VSYSLOG */
 
-static int _pam_log_is_silent(int ctrl)
+static BOOL _pam_log_is_silent(int ctrl)
 {
-       return (ctrl & WINBIND_SILENT) ? 1 : 0;
+       return on(ctrl, WINBIND_SILENT);
 }
 
 static void _pam_log(const pam_handle_t *pamh, int ctrl, int err, const char 
*format, ...)
@@ -91,27 +91,27 @@
        va_end(args);
 }
 
-static int _pam_log_is_debug_enabled(int ctrl)
+static BOOL _pam_log_is_debug_enabled(int ctrl)
 {
        if (ctrl == -1) {
-               return 0;
+               return False;
        }
 
        if (_pam_log_is_silent(ctrl)) {
-               return 0;
+               return False;
        }
 
        if (!(ctrl & WINBIND_DEBUG_ARG)) {
-               return 0;
+               return False;
        }
 
-       return 1;
+       return True;
 }
 
-static int _pam_log_is_debug_state_enabled(int ctrl)
+static BOOL _pam_log_is_debug_state_enabled(int ctrl)
 {
        if (!(ctrl & WINBIND_DEBUG_STATE)) {
-               return 0;
+               return False;
        }
 
        return _pam_log_is_debug_enabled(ctrl);
@@ -267,6 +267,8 @@
                /* generic options */
                if (!strcmp(*v,"debug"))
                        ctrl |= WINBIND_DEBUG_ARG;
+               else if (!strcasecmp(*v, "debug_state"))
+                       ctrl |= WINBIND_DEBUG_STATE;
                else if (!strcasecmp(*v, "use_authtok"))
                        ctrl |= WINBIND_USE_AUTHTOK_ARG;
                else if (!strcasecmp(*v, "use_first_pass"))
@@ -702,8 +704,7 @@
                        goto out;
                }
 
-               free(current_name);
-               current_name = NULL;
+               SAFE_FREE(current_name);
 
                if (!safe_append_string(sid_list_buffer, ",", 
sid_list_buffer_size)) {
                        goto out;
@@ -719,9 +720,7 @@
        result = 1;
 
 out:
-       if (current_name != NULL) {
-               free(current_name);
-       }
+       SAFE_FREE(current_name);
        return result;
 }
 

Reply via email to