Fix: compilation failure under OpenBSD with IPv6/KAME

This commit is contained in:
form 2000-01-12 18:43:40 +00:00
parent eba8ef7dce
commit 62e86c170d

View File

@ -1,25 +1,24 @@
*** authenticate.c.orig Wed May 13 23:57:39 1998 --- authenticate.c.orig Wed May 13 23:57:39 1998
--- authenticate.c Fri Oct 2 09:44:25 1998 +++ authenticate.c Thu Jan 13 00:26:51 2000
*************** @@ -22,7 +22,7 @@
*** 44,50 **** #else
#include "config.h"
-#define _XOPEN_SOURCE
+/* #define _XOPEN_SOURCE */
#include <sys/types.h>
#include <unistd.h>
@@ -44,7 +44,7 @@
#define VIRTUALUSER "vpop" #define VIRTUALUSER "vpop"
#ifndef MAILSPOOLDIR #ifndef MAILSPOOLDIR
! #define MAILSPOOLDIR "/var/spool/mail/" /* watch the trailing / */ -#define MAILSPOOLDIR "/var/spool/mail/" /* watch the trailing / */
+#define MAILSPOOLDIR "/var/mail/" /* watch the trailing / */
#endif #endif
#ifndef MAILSPOOLHASH #ifndef MAILSPOOLHASH
#define MAILSPOOLHASH 0 /* 2 would deliver to /var/spool/mail/b/a/bar */ #define MAILSPOOLHASH 0 /* 2 would deliver to /var/spool/mail/b/a/bar */
--- 44,50 ---- @@ -82,6 +82,7 @@
#define VIRTUALUSER "vpop"
#ifndef MAILSPOOLDIR
! #define MAILSPOOLDIR "/var/mail/" /* watch the trailing / */
#endif
#ifndef MAILSPOOLHASH
#define MAILSPOOLHASH 0 /* 2 would deliver to /var/spool/mail/b/a/bar */
***************
*** 82,87 ****
--- 82,88 ----
static void getlogname(user,sock)const char*user;const int sock; static void getlogname(user,sock)const char*user;const int sock;
{ struct sockaddr_in sockname;int namelen=sizeof sockname;const char*retval=""; { struct sockaddr_in sockname;int namelen=sizeof sockname;const char*retval="";
@ -27,33 +26,19 @@
if(!getsockname(sock,(struct sockaddr*)&sockname,&namelen)) if(!getsockname(sock,(struct sockaddr*)&sockname,&namelen))
{ const struct hostent*hent= { const struct hostent*hent=
gethostbyaddr((void*)&sockname.sin_addr.s_addr,sizeof sockname.sin_addr, gethostbyaddr((void*)&sockname.sin_addr.s_addr,sizeof sockname.sin_addr,
*************** @@ -89,16 +90,17 @@
*** 89,104 ****
if(hent) if(hent)
retval=hent->h_name; retval=hent->h_name;
} }
! if(auth_logname= /* memory leak when out of memory */ - if(auth_logname= /* memory leak when out of memory */
! realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1)) - realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1))
! { strcpy(auth_logname,retval)[namelen]='/'; - { strcpy(auth_logname,retval)[namelen]='/';
+ if(p=realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1))
+ { auth_logname=p;
+ strcpy(auth_logname,retval)[namelen]='/';
strcpy(auth_logname+namelen+1,user); strcpy(auth_logname+namelen+1,user);
! } - }
} + } else { free(auth_logname); auth_logname=NULL; }
static const struct passwd*cgetpwnam(user,sock)const char*user;
const int sock;
{
#ifdef VIRTUALSERVER
DB_ENV dbenv;DB*db;
memset(&dbenv,0,sizeof dbenv);
--- 90,106 ----
if(hent)
retval=hent->h_name;
}
! if(p=realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1))
! { auth_logname=p;
! strcpy(auth_logname,retval)[namelen]='/';
strcpy(auth_logname+namelen+1,user);
! } else { free(auth_logname); auth_logname=NULL; }
} }
static const struct passwd*cgetpwnam(user,sock)const char*user; static const struct passwd*cgetpwnam(user,sock)const char*user;
@ -63,38 +48,27 @@
#ifdef VIRTUALSERVER #ifdef VIRTUALSERVER
DB_ENV dbenv;DB*db; DB_ENV dbenv;DB*db;
memset(&dbenv,0,sizeof dbenv); memset(&dbenv,0,sizeof dbenv);
*************** @@ -129,14 +131,18 @@
*** 129,142 ****
novirt: strcpy(auth_logname,user); novirt: strcpy(auth_logname,user);
} }
db->close(db,0); db->close(db,0);
! } /* memory leak when out of memory */ - } /* memory leak when out of memory */
! else if(auth_logname=realloc(auth_logname,strlen(user)+1)) - else if(auth_logname=realloc(auth_logname,strlen(user)+1))
! strcpy(auth_logname,user); /* DB doesn't exist */ - strcpy(auth_logname,user); /* DB doesn't exist */
+ }
+ else if(p=realloc(auth_logname,strlen(user)+1))
+ { auth_logname=p;
+ strcpy(auth_logname,user); /* DB doesn't exist */
+ } else { free(auth_logname); auth_logname=NULL; }
db_appexit(&dbenv); db_appexit(&dbenv);
} }
else /* DB subsystem problem */ else /* DB subsystem problem */
! { if(auth_logname=realloc(auth_logname,strlen(user)+1)) - { if(auth_logname=realloc(auth_logname,strlen(user)+1))
! strcpy(auth_logname,user); - strcpy(auth_logname,user);
} + { if(p=realloc(auth_logname,strlen(user)+1))
#endif + { auth_logname=p;
return getpwnam(user); /* this should be selfexplanatory :-) */ + strcpy(auth_logname,user);
--- 131,148 ---- + } else { free(auth_logname); auth_logname=NULL; }
novirt: strcpy(auth_logname,user);
}
db->close(db,0);
! }
! else if(p=realloc(auth_logname,strlen(user)+1))
! { auth_logname=p;
! strcpy(auth_logname,user); /* DB doesn't exist */
! } else { free(auth_logname); auth_logname=NULL; }
db_appexit(&dbenv);
}
else /* DB subsystem problem */
! { if(p=realloc(auth_logname,strlen(user)+1))
! { auth_logname=p;
! strcpy(auth_logname,user);
! } else { free(auth_logname); auth_logname=NULL; }
} }
#endif #endif
return getpwnam(user); /* this should be selfexplanatory :-) */ return getpwnam(user); /* this should be selfexplanatory :-) */