Permalink
Browse files

prevent segfault when no user filters are specified

  • Loading branch information...
1 parent 5e59c48 commit 9d4234fbd69ee2ef93039f99c8a8e9bcab11e9a8 @jwm jwm committed Dec 18, 2011
Showing with 8 additions and 5 deletions.
  1. +4 −1 README
  2. +4 −4 mod_ldap.c
View
5 README
@@ -1,4 +1,4 @@
-mod_ldap v2.9.1
+mod_ldap v2.9.2
===============
mod_ldap is a ProFTPD module that performs user authentication and
@@ -59,6 +59,9 @@ code improvements or ideas for development, please let me know!
==========
3. Changes
==========
+v2.9.2:
+- Fix segmentation fault when no user filters (second and third arguments to
+ LDAPUsers) are specified.
v2.9.1:
- Handle potential NULL return value from crypt(). (Bug #3551)
View
@@ -1,6 +1,6 @@
/*
* mod_ldap - LDAP password lookup module for ProFTPD
- * Copyright (c) 1999-2010, John Morrissey <jwm@horde.net>
+ * Copyright (c) 1999-2011, John Morrissey <jwm@horde.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@
#include "conf.h"
#include "privs.h"
-#define MOD_LDAP_VERSION "mod_ldap/2.9.1"
+#define MOD_LDAP_VERSION "mod_ldap/2.9.2"
#if PROFTPD_VERSION_NUMBER < 0x0001030103
# error MOD_LDAP_VERSION " requires ProFTPD 1.3.1rc3 or later"
@@ -1978,14 +1978,14 @@ ldap_getconf(void)
ldap_do_users = 1;
ldap_user_basedn = pstrdup(session.pool, c->argv[0]);
- if (c->argv[1]) {
+ if (c->argc > 1) {
ldap_user_name_filter = pstrdup(session.pool, c->argv[1]);
} else {
ldap_user_name_filter = pstrcat(session.pool,
"(&(", ldap_attr_uid, "=%v)(objectclass=posixAccount))", NULL);
}
- if (c->argv[2]) {
+ if (c->argc > 2) {
ldap_user_uid_filter = pstrdup(session.pool, c->argv[2]);
} else {
ldap_user_uid_filter = pstrcat(session.pool,

0 comments on commit 9d4234f

Please sign in to comment.