summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2005-09-30 09:09:51 +0000
committerSteve Langasek <vorlon@debian.org>2005-09-30 09:09:51 +0000
commit5d398d514940ad9301e36126a62b206cf6728bbf (patch)
tree2074bddfbdd75b80b38517685cfdbaec4652256e
parente040af5792bb4c9cb8671365dedb2241cd041eca (diff)
Relevant BUGIDs: none
Purpose of commit: bugfix Commit summary: --------------- Fix memory leak due to gratuitous use of strdup().
-rw-r--r--ChangeLog5
-rw-r--r--modules/pam_userdb/pam_userdb.c14
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e5cda09d..20850d4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-30 Steve Langasek <vorlon@debian.org>
+
+ * modules/pam_userdb/pam_userdb.c: Fix memory leak due to
+ gratuitous use of strdup().
+
2005-09-27 Thorsten Kukuk <kukuk@thkukuk.de>
* release 0.99.1.0
diff --git a/modules/pam_userdb/pam_userdb.c b/modules/pam_userdb/pam_userdb.c
index f584a438..662c7ac3 100644
--- a/modules/pam_userdb/pam_userdb.c
+++ b/modules/pam_userdb/pam_userdb.c
@@ -113,14 +113,14 @@ _pam_parse (pam_handle_t *pamh, int argc, const char **argv,
ctrl |= PAM_TRY_FPASS_ARG;
else if (!strncasecmp(*argv,"db=", 3))
{
- *database = strdup((*argv) + 3);
+ *database = (*argv) + 3;
if ((*database == NULL) || (strlen (*database) == 0))
pam_syslog(pamh, LOG_ERR,
"could not parse argument \"%s\"", *argv);
}
else if (!strncasecmp(*argv,"crypt=", 6))
{
- *cryptmode = strdup((*argv) + 6);
+ *cryptmode = (*argv) + 6;
if ((*cryptmode == NULL) || (strlen (*cryptmode) == 0))
pam_syslog(pamh, LOG_ERR,
"could not parse argument \"%s\"", *argv);
@@ -239,13 +239,13 @@ user_lookup (pam_handle_t *pamh, const char *database, const char *cryptmode,
* default to plaintext password storage
*/
- if (strlen(pass) != (size_t)data.dsize) {
- compare = 1; /* wrong password len -> wrong password */
- } else if (ctrl & PAM_ICASE_ARG) {
+ if (strlen(pass) != (size_t)data.dsize) {
+ compare = 1; /* wrong password len -> wrong password */
+ } else if (ctrl & PAM_ICASE_ARG) {
compare = strncasecmp(data.dptr, pass, data.dsize);
- } else {
+ } else {
compare = strncmp(data.dptr, pass, data.dsize);
- }
+ }
if (cryptmode && strncasecmp(cryptmode, "none", 4)
&& (ctrl & PAM_DEBUG_ARG)) {