Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Nov 2002 17:54:58 +0100 (CET)
From:      Ludo Koren <lk@tempest.sk>
To:        erlis@engineer.com
Cc:        freebsd-isp@FreeBSD.ORG
Subject:   Re: standalone pop3 daemon
Message-ID:  <200211291654.gATGsw4F094658@lk.tempest.sk>
In-Reply-To: <20021129102242.GB91480@engineer.com> (message from Andrew Scherbachenko on Fri, 29 Nov 2002 12:22:42 %2B0200)

next in thread | previous in thread | raw e-mail | index | archive | help

     > Qpopper can work with LDAP via PAM but it require fake records
     > in /etc/master.passwd 8-( Does anyone know subj that can work
     > with LDAP without any additional requirements like records in
     > /etc/master.passwd or so?


I did it a while ago. Try to apply the following patches. I assume,
you have sources of sendmail in /usr/src/contrib/sendmail and sendmail
library in /usr/obj/usr/src/lib/libsm.

Regards,
ludo

*** Makefile.patched	Thu Oct 17 12:20:46 2002
--- Makefile	Thu Oct 17 11:56:39 2002
***************
*** 151,157 ****
                      ${common_dir}/string_util.h
  
  
! CFLAGS          =   -O -pipe  -freg-struct-return 
  CDEFS           =   
  OS_DEFS         =   -DSETPROCTITLE  -DFREEBSD -DUNIX
  DEFS            =   -DHAVE_CONFIG_H
--- 151,157 ----
                      ${common_dir}/string_util.h
  
  
! CFLAGS          =   -O -pipe  -freg-struct-return -I/usr/src/contrib/sendmail/include -I/usr/obj/usr/src/lib/libsm
  CDEFS           =   
  OS_DEFS         =   -DSETPROCTITLE  -DFREEBSD -DUNIX
  DEFS            =   -DHAVE_CONFIG_H
***************
*** 161,167 ****
  NETWORK_LIBS    =   
  KERBEROS_LIBS   =   
  DBM_LIBS        =   
! LIBS            =      -lmd -lutil -L/usr/local/lib -lpam -L/usr/lib -lssl -lcrypto
  AR_FLAG         =    -r 
  RANLIB_CMD      =   
  
--- 161,167 ----
  NETWORK_LIBS    =   
  KERBEROS_LIBS   =   
  DBM_LIBS        =   
! LIBS            =      -lmd -lutil -L/usr/local/lib -lpam -L/usr/lib -lssl -lcrypto /usr/obj/usr/src/lib/libsm/libsm.a -lldap -llber
  AR_FLAG         =    -r 
  RANLIB_CMD      =   
  

------------------ cut here ----------------------------------

*** pop_pass.c.patched	Thu Oct 17 10:54:32 2002
--- pop_pass.c	Thu Oct 17 12:09:06 2002
***************
*** 135,140 ****
--- 135,141 ----
  #endif /* KERBEROS */
  
  #include "snprintf.h"
+ #include <sm/mbdb.h>
  
  #define SLEEP_SECONDS 10
  
***************
*** 440,445 ****
--- 441,447 ----
      int              pamerror       = 0;
      int              erc            = 0;
      const char      *errmsg         = NULL;
+     SM_MBDB_T       user;
  
      /* 
       * Let conv function access POP structure 
***************
*** 479,484 ****
--- 481,492 ----
          return  ( pop_msg ( p, POP_FAILURE, HERE, GP_ERRSTRING, 
                              p->user, errmsg, erc ) );
      }
+     sm_mbdb_initialize ("ldap");
+     sm_mbdb_lookup ( p->user, &user );
+     (&p->pw)->pw_name = strdup ( p->user );
+     (&p->pw)->pw_uid = user.mbdb_uid;
+     (&p->pw)->pw_gid = user.mbdb_gid;
+     sm_mbdb_terminate ();
      pamerror = pam_acct_mgmt ( pamh, 0 );
      DEBUG_LOG1 ( p, "pam_acct_mgmt returned %i", pamerror );
      if ( pamerror != PAM_SUCCESS ) {
***************
*** 1275,1280 ****
--- 1283,1289 ----
  
      *secretkey = '\0';
  #endif /* SECURENISPLUS */
+     SM_MBDB_T       user;
  
      /* 
       * Is the user not authorized to use POP? 
***************
*** 1296,1301 ****
--- 1305,1317 ----
       * Verify user known by system. 
       */
      pwp = &p->pw;
+     sm_mbdb_initialize ("ldap");
+     sm_mbdb_lookup ( p->user, &user );
+     pwp->pw_name = strdup ( p->user );
+     pwp->pw_uid = user.mbdb_uid;
+     pwp->pw_gid = user.mbdb_gid;
+     sm_mbdb_terminate ();
+ 
      if ( pwp->pw_name == NULL ) {
          DEBUG_LOG1 ( p, "User %.128s not known by system",
                       p->user );

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211291654.gATGsw4F094658>