Here is the patch that will add a --nowarn option to nslcd. This is not
default so it would not break existing installations.
----- BEGIN -----
diff -ru nss-pam-ldapd-0.8.4/nslcd/nslcd.c nss-pam-ldapd-0.8.4.1/nslcd/nslcd.c
--- nss-pam-ldapd-0.8.4/nslcd/nslcd.c 2011-04-18 17:29:09.000000000 -0400
+++ nss-pam-ldapd-0.8.4.1/nslcd/nslcd.c 2011-09-16 20:18:43.000000000 -0400
@@ -79,6 +79,9 @@
/* the exit flag to indicate that a signal was received */
static volatile int nslcd_exitsignal=0;
+/* useless warnings flag (defined in pam.c) */
+extern int useless_warnings;
+
/* the server socket used for communication */
static int nslcd_serversocket=-1;
@@ -120,6 +123,7 @@
fprintf(fp," -d, --debug don't fork and print debugging to
stderr\n");
fprintf(fp," --help display this help and exit\n");
fprintf(fp," --version output version information and exit\n");
+ fprintf(fp," --nowarn disable useless warnings\n");
fprintf(fp,"\n"
"Report bugs to <%s>.\n",PACKAGE_BUGREPORT);
}
@@ -131,9 +135,10 @@
{ "debug", no_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
+ { "nowarn", no_argument, NULL, 'W' },
{ NULL, 0, NULL, 0 }
};
-#define NSLCD_OPTIONSTRING "cdhV"
+#define NSLCD_OPTIONSTRING "cdhVW"
/* parse command line options and save settings in struct */
static void parse_cmdline(int argc,char *argv[])
@@ -156,6 +161,9 @@
case 'V': /* --version output version information and exit */
display_version(stdout);
exit(EXIT_SUCCESS);
+ case 'W': /* --nowarn disable useless warnings */
+ useless_warnings=0;
+ break;
case ':': /* missing required parameter */
case '?': /* unknown option character or extraneous parameter */
default:
diff -ru nss-pam-ldapd-0.8.4/nslcd/pam.c nss-pam-ldapd-0.8.4.1/nslcd/pam.c
--- nss-pam-ldapd-0.8.4/nslcd/pam.c 2011-06-10 04:49:11.000000000 -0400
+++ nss-pam-ldapd-0.8.4.1/nslcd/pam.c 2011-09-16 20:18:31.000000000 -0400
@@ -39,6 +39,16 @@
#include "common/dict.h"
#include "common/expr.h"
+/* useless warnings flag
+ * this disables the following warnings when set to 0
+ *
+ * lookup of <user> failed
+ * <user>: not found
+ *
+ * defined here because the test_* don't link with nslcd.o
+ */
+int useless_warnings=1;
+
/* set up a connection and try to bind with the specified DN and password,
returns an LDAP result code */
static int try_bind(const char *userdn,const char *password)
@@ -62,7 +72,8 @@
{
if (rc==LDAP_SUCCESS)
rc=LDAP_LOCAL_ERROR;
- log_log(LOG_WARNING,"lookup of %s failed: %s",userdn,ldap_err2string(rc));
+ if (useless_warnings)
+ log_log(LOG_WARNING,"lookup of %s failed:
%s",userdn,ldap_err2string(rc));
}
else
{
@@ -71,7 +82,8 @@
{
if (rc==LDAP_SUCCESS)
rc=LDAP_NO_RESULTS_RETURNED;
- log_log(LOG_WARNING,"lookup of %s failed:
%s",userdn,ldap_err2string(rc));
+ if (useless_warnings)
+ log_log(LOG_WARNING,"lookup of %s failed:
%s",userdn,ldap_err2string(rc));
}
}
/* close the session */
@@ -100,7 +112,8 @@
{
if (rc==LDAP_SUCCESS)
rc=LDAP_NO_SUCH_OBJECT;
- log_log(LOG_WARNING,"\"%s\": user not found:
%s",username,ldap_err2string(rc));
+ if (useless_warnings)
+ log_log(LOG_WARNING,"\"%s\": user not found:
%s",username,ldap_err2string(rc));
*rcp=rc;
}
return entry;
----- END -----
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]