Author: lmuelle
Date: 2007-07-04 20:25:29 +0000 (Wed, 04 Jul 2007)
New Revision: 23708

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

Log:
- Add define for WINBIND_WARN_PWD_EXPIRE.
- Add parameter config_flag to get_config_item_int() and do the same
  check as in get_conf_item_string.

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.c    2007-07-04 19:52:51 UTC 
(rev 23707)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.c    2007-07-04 20:25:29 UTC 
(rev 23708)
@@ -264,6 +264,10 @@
                ctrl |= WINBIND_TRY_FIRST_PASS_ARG;
        }
 
+       if (iniparser_getint(d, "global:warn_pwd_expire", 0)) {
+               ctrl |= WINBIND_WARN_PWD_EXPIRE;
+       }
+
 config_from_pam:
        /* step through arguments */
        for (i=argc,v=argv; i-- > 0; ++v) {
@@ -1532,10 +1536,15 @@
                              const char **argv,
                              int ctrl,
                              dictionary *d,
-                             const char *item)
+                             const char *item,
+                             int config_flag)
 {
        int i, parm_opt = -1;
 
+       if (!(ctrl & config_flag)) {
+               goto out;
+       }
+
        /* let the pam opt take precedence over the pam_winbind.conf option */
        for (i = 0; i < argc; i++) {
 
@@ -1597,7 +1606,7 @@
 {
        int ret;
        ret = get_config_item_int(pamh, argc, argv, ctrl, d,
-                                 "warn_pwd_expire");
+                                 "warn_pwd_expire", WINBIND_WARN_PWD_EXPIRE);
        /* no or broken setting */
        if (ret <= 0) {
                return DEFAULT_DAYS_TO_WARN_BEFORE_PWD_EXPIRES;

Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.h
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.h    2007-07-04 19:52:51 UTC 
(rev 23707)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.h    2007-07-04 20:25:29 UTC 
(rev 23708)
@@ -95,6 +95,7 @@
 #define WINBIND_CONFIG_FILE (1<<10)
 #define WINBIND_SILENT (1<<11)
 #define WINBIND_DEBUG_STATE (1<<12)
+#define WINBIND_WARN_PWD_EXPIRE (1<<13)
 
 /*
  * here is the string to inform the user that the new passwords they

Modified: branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c 2007-07-04 19:52:51 UTC 
(rev 23707)
+++ branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c 2007-07-04 20:25:29 UTC 
(rev 23708)
@@ -264,6 +264,10 @@
                ctrl |= WINBIND_TRY_FIRST_PASS_ARG;
        }
 
+       if (iniparser_getint(d, "global:warn_pwd_expire", 0)) {
+               ctrl |= WINBIND_WARN_PWD_EXPIRE;
+       }
+
 config_from_pam:
        /* step through arguments */
        for (i=argc,v=argv; i-- > 0; ++v) {
@@ -1532,10 +1536,15 @@
                              const char **argv,
                              int ctrl,
                              dictionary *d,
-                             const char *item)
+                             const char *item,
+                             int config_flag)
 {
        int i, parm_opt = -1;
 
+       if (!(ctrl & config_flag)) {
+               goto out;
+       }
+
        /* let the pam opt take precedence over the pam_winbind.conf option */
        for (i = 0; i < argc; i++) {
 
@@ -1597,7 +1606,7 @@
 {
        int ret;
        ret = get_config_item_int(pamh, argc, argv, ctrl, d,
-                                 "warn_pwd_expire");
+                                 "warn_pwd_expire", WINBIND_WARN_PWD_EXPIRE);
        /* no or broken setting */
        if (ret <= 0) {
                return DEFAULT_DAYS_TO_WARN_BEFORE_PWD_EXPIRES;

Modified: branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.h
===================================================================
--- branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.h 2007-07-04 19:52:51 UTC 
(rev 23707)
+++ branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.h 2007-07-04 20:25:29 UTC 
(rev 23708)
@@ -95,6 +95,7 @@
 #define WINBIND_CONFIG_FILE (1<<10)
 #define WINBIND_SILENT (1<<11)
 #define WINBIND_DEBUG_STATE (1<<12)
+#define WINBIND_WARN_PWD_EXPIRE (1<<13)
 
 /*
  * here is the string to inform the user that the new passwords they

Reply via email to