Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > media > main-backports-src > by-pkgid > 43742945d611736e6e3dda2185b2f9fe > files > 16

proftpd-1.3.1-3mdv2008.0.src.rpm

Index: src/auth.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/auth.c,v
retrieving revision 1.48
diff -u -r1.48 auth.c
--- src/auth.c	17 Apr 2007 21:33:40 -0000	1.48
+++ src/auth.c	18 May 2007 15:01:56 -0000
@@ -442,6 +442,32 @@
 
   cmd = make_cmd(p, 2, name, pw);
 
+  /* First, check for the mod_auth_pam.c module.
+   *
+   * PAM is a bit of hack in this Auth API, because PAM only provides
+   * yes/no checks, and is not a source of user information.
+   */
+  m = pr_module_get("mod_auth_pam.c");
+  if (m) {
+    pr_trace_msg(trace_channel, 4,
+      "using module 'mod_auth_pam.c' to authenticate user '%s'", name);
+
+    mr = dispatch_auth(cmd, "auth", &m);
+
+    if (MODRET_ISHANDLED(mr)) {
+      res = MODRET_HASDATA(mr) ? PR_AUTH_RFC2228_OK : PR_AUTH_OK;
+
+      if (cmd->tmp_pool) {
+        destroy_pool(cmd->tmp_pool);
+        cmd->tmp_pool = NULL;
+      }
+
+      return res;
+    }
+
+    m = NULL;
+  }
+
   if (auth_tab) {
 
     /* Fetch the specific module to be used for authenticating this user. */
@@ -479,6 +505,32 @@
 
   cmd = make_cmd(p, 3, cpw, name, pw);
 
+  /* First, check for the mod_auth_pam.c module.  
+   *
+   * PAM is a bit of hack in this Auth API, because PAM only provides
+   * yes/no checks, and is not a source of user information.
+   */
+  m = pr_module_get("mod_auth_pam.c");
+  if (m) {
+    pr_trace_msg(trace_channel, 4,
+      "using module 'mod_auth_pam.c' to authenticate user '%s'", name);
+
+    mr = dispatch_auth(cmd, "check", &m);
+
+    if (MODRET_ISHANDLED(mr)) {
+      res = MODRET_HASDATA(mr) ? PR_AUTH_RFC2228_OK : PR_AUTH_OK;
+
+      if (cmd->tmp_pool) {
+        destroy_pool(cmd->tmp_pool);
+        cmd->tmp_pool = NULL;
+      }
+
+      return res;
+    }
+
+    m = NULL;
+  }
+
   if (auth_tab) {
 
     /* Fetch the specific module to be used for authenticating this user. */