gpaterno / otpd

Automatically exported from code.google.com/p/otpd
GNU General Public License v2.0
0 stars 0 forks source link

crash when user not found #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I we have a crash with ldap user when ldap user are not present on ldap tree.

we ave fix with control of user pointer on otp.c main file.

the line 690...
config->userops->put(user);..

aer change
if(user!=NULL) config->userops->put(user);

Good work

Original issue reported on code.google.com by marcom1...@gmail.com on 12 Oct 2010 at 3:16

GoogleCodeExporter commented 9 years ago

Original comment by fr...@gmail.com on 2 Nov 2010 at 12:11

GoogleCodeExporter commented 9 years ago
That's the wrong place to fix this. Fix it in config->userops->put instead to 
make put defensive.

*** otpd-3.2.5/userops/ldap.c   2011-02-11 02:01:49.000000000 -0800
--- otpd-3.2.5-dist/userops/ldap.c  2009-11-30 07:09:14.000000000 -0800
***************
*** 450,460 ****
  static void
  ldap_put(user_t *user)
  {
!   if (user) {
!     if (user->password)
!       free(user->password);
!     free(user);
!   }
  }

  /* get a bound ldap connection from the pool */
--- 450,458 ----
  static void
  ldap_put(user_t *user)
  {
!   if (user->password)
!     free(user->password);
!   free(user);
  }

  /* get a bound ldap connection from the pool */

Original comment by djne...@gmail.com on 11 Feb 2011 at 10:07