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,100 +1,74 @@
*** 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
#define VIRTUALUSER "vpop" #include "config.h"
#ifndef MAILSPOOLDIR -#define _XOPEN_SOURCE
! #define MAILSPOOLDIR "/var/spool/mail/" /* watch the trailing / */ +/* #define _XOPEN_SOURCE */
#endif
#ifndef MAILSPOOLHASH #include <sys/types.h>
#define MAILSPOOLHASH 0 /* 2 would deliver to /var/spool/mail/b/a/bar */ #include <unistd.h>
--- 44,50 ---- @@ -44,7 +44,7 @@
#define VIRTUALUSER "vpop" #define VIRTUALUSER "vpop"
#ifndef MAILSPOOLDIR #ifndef MAILSPOOLDIR
! #define MAILSPOOLDIR "/var/mail/" /* watch the trailing / */ -#define MAILSPOOLDIR "/var/spool/mail/" /* watch the trailing / */
#endif +#define MAILSPOOLDIR "/var/mail/" /* watch the trailing / */
#ifndef MAILSPOOLHASH #endif
#define MAILSPOOLHASH 0 /* 2 would deliver to /var/spool/mail/b/a/bar */ #ifndef MAILSPOOLHASH
*************** #define MAILSPOOLHASH 0 /* 2 would deliver to /var/spool/mail/b/a/bar */
*** 82,87 **** @@ -82,6 +82,7 @@
--- 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=""; + void *p;
+ void *p; 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 @@
*************** if(hent)
*** 89,104 **** retval=hent->h_name;
if(hent) }
retval=hent->h_name; - if(auth_logname= /* memory leak when out of memory */
} - realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1))
! if(auth_logname= /* memory leak when out of memory */ - { strcpy(auth_logname,retval)[namelen]='/';
! realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1)) + if(p=realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1))
! { strcpy(auth_logname,retval)[namelen]='/'; + { auth_logname=p;
strcpy(auth_logname+namelen+1,user); + 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; }
const int sock;
{ static const struct passwd*cgetpwnam(user,sock)const char*user;
#ifdef VIRTUALSERVER const int sock;
DB_ENV dbenv;DB*db; {
memset(&dbenv,0,sizeof dbenv); + void *p;
--- 90,106 ---- #ifdef VIRTUALSERVER
if(hent) DB_ENV dbenv;DB*db;
retval=hent->h_name; memset(&dbenv,0,sizeof dbenv);
} @@ -129,14 +131,18 @@
! if(p=realloc(auth_logname,(namelen=strlen(retval))+1+strlen(user)+1)) novirt: strcpy(auth_logname,user);
! { auth_logname=p; }
! strcpy(auth_logname,retval)[namelen]='/'; db->close(db,0);
strcpy(auth_logname+namelen+1,user); - } /* memory leak when out of memory */
! } else { free(auth_logname); auth_logname=NULL; } - else if(auth_logname=realloc(auth_logname,strlen(user)+1))
} - strcpy(auth_logname,user); /* DB doesn't exist */
+ }
static const struct passwd*cgetpwnam(user,sock)const char*user; + else if(p=realloc(auth_logname,strlen(user)+1))
const int sock; + { auth_logname=p;
{ + strcpy(auth_logname,user); /* DB doesn't exist */
+ void *p; + } else { free(auth_logname); auth_logname=NULL; }
#ifdef VIRTUALSERVER db_appexit(&dbenv);
DB_ENV dbenv;DB*db; }
memset(&dbenv,0,sizeof dbenv); else /* DB subsystem problem */
*************** - { if(auth_logname=realloc(auth_logname,strlen(user)+1))
*** 129,142 **** - strcpy(auth_logname,user);
novirt: strcpy(auth_logname,user); + { if(p=realloc(auth_logname,strlen(user)+1))
} + { auth_logname=p;
db->close(db,0); + strcpy(auth_logname,user);
! } /* memory leak when out of memory */ + } else { free(auth_logname); auth_logname=NULL; }
! else if(auth_logname=realloc(auth_logname,strlen(user)+1)) }
! strcpy(auth_logname,user); /* DB doesn't exist */ #endif
db_appexit(&dbenv); return getpwnam(user); /* this should be selfexplanatory :-) */
}
else /* DB subsystem problem */
! { if(auth_logname=realloc(auth_logname,strlen(user)+1))
! strcpy(auth_logname,user);
}
#endif
return getpwnam(user); /* this should be selfexplanatory :-) */
--- 131,148 ----
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
return getpwnam(user); /* this should be selfexplanatory :-) */