Commit 3952bc8e authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Update for Alpha3 from -devel as of OPENLDAP_DEVEL_981116.

Includes everything but ldapext & ldap.conf changes.
parent cea69246
OpenLDAP Change Log
Changes included in OpenLDAP 1.1-Alpha (from -devel)
CVS Tag: OPENLDAP_REL_ENG_1_1
CVS Tag: OPENLDAP_REL_ENG_1_1_ALPHA3
Changed LDBM default to sync on writes
Added mail500 BOUNCEFROM patch
Added dbcachenowsync option
Fixed slapd/ldbm id2children bug
Fixed slapd/shell newline bug
Fixed whois++ get_dn leak
Fixed DEC OSF1 (alpha) support
Fixed pointer truncation to int bugs
Fixed DEC OSF/1 support bugs
Fixed r/w lock initialization on non-final Pthreads
Fixed slapd/slurpd file unlock bugs
Fixed slurpd string translation bug
......@@ -24,6 +25,8 @@ Changes included in OpenLDAP 1.1-Alpha (from -devel)
Added pwd.h & getpwuid() tests
Added sys/resource.h test
Updated NT support (now builds ud)
Added function prototypes
Removed library externs
Removed lint
......
#ifndef FAX500_H
#define FAX500_H 1
/* in faxtotpc.c */
void strip_nonnum ( char *str );
char *remove_parens( char *ibuf, char *obuf );
char *munge_phone ( char *ibuf, char *obuf );
char *faxtotpc ( char *phone, char *userinfo );
#endif
......@@ -21,18 +21,20 @@
#include "portable.h"
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <ac/ctype.h>
#include <ac/string.h>
#include "fax500.h"
#define TPCDOMAIN "tpc.int"
/*
* Remove everything from 'str' which is not a digit
*/
void strip_nonnum(str)
char *str;
void
strip_nonnum( char *str )
{
char *p, *q;
p = q = str;
......@@ -58,9 +60,8 @@ char *str;
* Remove anything of the form (blah) where
* "blah" contains a non-numeric character.
*/
char *remove_parens(ibuf, obuf)
char *ibuf;
char *obuf;
char *
remove_parens( char *ibuf, char *obuf )
{
char *p = ibuf;
char *q = obuf;
......@@ -129,9 +130,8 @@ char *obuf;
* 6 93
* 8 99
*/
char *munge_phone(ibuf, obuf)
char *ibuf;
char *obuf;
char *
munge_phone( char *ibuf, char *obuf )
{
#define UMAREACODE "1313"
......@@ -173,17 +173,11 @@ char *obuf;
/*
* Convert string to "tpc.int" domain name.
*/
char *faxtotpc(phone, userinfo)
char *phone;
char *userinfo;
char *
faxtotpc( char *phone, char *userinfo )
{
char *p;
char *q;
......@@ -241,5 +235,4 @@ char *userinfo;
strcat(obuf, TPCDOMAIN); /* tack on domain name */
p = strdup(obuf);
return(p);
}
......@@ -14,23 +14,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/syslog.h>
#include <ac/time.h>
#include <ac/wait.h>
#include <ac/unistd.h>
#include <ac/errno.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <sysexits.h>
#include "lber.h"
#include "ldap.h"
#include "fax500.h"
#include <ldapconfig.h>
#define USER 0
......@@ -47,7 +53,6 @@ char *errorsfrom = NULL;
char *mailfrom = NULL;
char *host = NULL;
int hostlen = 0;
char *faxtotpc();
int identity;
#define MAIL500 1
......@@ -103,27 +108,33 @@ static char *attrs[] = { "objectClass", "title", "postaladdress",
"rfc822RequestsTo", "joinable", "cn", "member",
"facsimileTelephoneNumber", NULL };
static do_address();
static do_group();
static do_group_members();
static send_message();
static send_errors();
static do_noemailorfax();
static do_ambiguous();
static add_to();
static isgroup();
static add_error();
static add_group();
static unbind_and_exit();
static group_loop();
static send_group();
static has_attributes();
static char **get_attributes_mail_dn();
static char *canonical();
main (argc, argv)
int argc;
char **argv;
static void do_address(char *name, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr, int type);
static int do_group(LDAPMessage *e, char *dn, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr);
static void do_group_members(LDAPMessage *e, char *dn, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr);
static void send_message(char **to);
static void send_errors(Error *err, int nerr);
static void do_noemailorfax(FILE *fp, Error *err, int namelen, int errtype);
static void do_ambiguous(FILE *fp, Error *err, int namelen);
static int count_values(char **list);
static void add_to(char ***list, int *nlist, char **new);
static int isgroup(LDAPMessage *e);
static void add_error(Error **err, int *nerr, int code, char *addr, LDAPMessage *msg);
static void add_group(char *dn, Group **list, int *nlist);
static void unbind_and_exit(int rc);
static int group_loop(char *dn);
static void send_group(Group *group, int ngroup);
static int has_attributes(LDAPMessage *e, char *attr1, char *attr2);
static char **get_attributes_mail_dn(LDAPMessage *e, char *attr1, char *attr2);
static char *canonical(char *s);
static int connect_to_x500 (void);
static void do_group_errors (LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr);
static void do_group_request (LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr);
static void add_member (char *gdn, char *dn, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr);
int
main ( int argc, char **argv )
{
char *myname;
char **tolist;
......@@ -131,9 +142,6 @@ char **argv;
Group *togroups;
int numto, ngroups, numerr, nargs;
int i, j;
FILE *fp;
extern int optind, errno;
extern char *optarg;
while ( (i = getopt( argc, argv, "f:h:m:" )) != EOF ) {
switch( i ) {
......@@ -255,7 +263,7 @@ char **argv;
*/
if ( numerr > 0 && numto > nargs || ngroups > 0 ) {
int fd;
FILE *fp;
char buf[BUFSIZ];
umask( 077 );
......@@ -303,7 +311,8 @@ char **argv;
return( EX_OK );
}
connect_to_x500()
static int
connect_to_x500( void )
{
if ( (ld = ldap_open( LDAPHOST, LDAP_PORT )) == NULL ) {
syslog( LOG_ALERT, "ldap_open failed" );
......@@ -321,16 +330,17 @@ connect_to_x500()
}
static
do_address( name, to, nto, togroups, ngroups, err, nerr, type )
char *name;
char ***to;
int *nto;
Group **togroups;
int *ngroups;
Error **err;
int *nerr;
int type;
static void
do_address(
char *name,
char ***to,
int *nto,
Group **togroups,
int *ngroups,
Error **err,
int *nerr,
int type
)
{
int rc, b, f, match;
LDAPMessage *e, *res;
......@@ -572,16 +582,17 @@ do_address( name, to, nto, togroups, ngroups, err, nerr, type )
return;
}
static
do_group( e, dn, to, nto, togroups, ngroups, err, nerr )
LDAPMessage *e;
char *dn;
char ***to;
int *nto;
Group **togroups;
int *ngroups;
Error **err;
int *nerr;
static int
do_group(
LDAPMessage *e,
char *dn,
char ***to,
int *nto,
Group **togroups,
int *ngroups,
Error **err,
int *nerr
)
{
/*
* If this group has an rfc822ErrorsTo attribute, we need to
......@@ -610,16 +621,17 @@ do_group( e, dn, to, nto, togroups, ngroups, err, nerr )
}
/* ARGSUSED */
static
do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
LDAPMessage *e;
char *dn;
char ***to;
int *nto;
Group **togroups;
int *ngroups;
Error **err;
int *nerr;
static void
do_group_members(
LDAPMessage *e,
char *dn,
char ***to,
int *nto,
Group **togroups,
int *ngroups,
Error **err,
int *nerr
)
{
int i, rc;
char *ndn;
......@@ -785,15 +797,17 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
return;
}
add_member( gdn, dn, to, nto, togroups, ngroups, err, nerr )
char *gdn;
char *dn;
char ***to;
int *nto;
Group **togroups;
int *ngroups;
Error **err;
int *nerr;
static void
add_member(
char *gdn,
char *dn,
char ***to,
int *nto,
Group **togroups,
int *ngroups,
Error **err,
int *nerr
)
{
char *ndn;
char **mail;
......@@ -876,13 +890,15 @@ add_member( gdn, dn, to, nto, togroups, ngroups, err, nerr )
return;
}
do_group_request( e, dn, to, nto, err, nerr )
LDAPMessage *e;
char *dn;
char ***to;
int *nto;
Error **err;
int *nerr;
static void
do_group_request(
LDAPMessage *e,
char *dn,
char ***to,
int *nto,
Error **err,
int *nerr
)
{
char **requeststo;
......@@ -894,17 +910,17 @@ do_group_request( e, dn, to, nto, err, nerr )
} else {
add_error( err, nerr, E_NOREQUEST, dn, NULLMSG );
}
return;
}
do_group_errors( e, dn, to, nto, err, nerr )
LDAPMessage *e;
char *dn;
char ***to;
int *nto;
Error **err;
int *nerr;
static void
do_group_errors(
LDAPMessage *e,
char *dn,
char ***to,
int *nto,
Error **err,
int *nerr
)
{
char **errorsto;
......@@ -916,13 +932,10 @@ do_group_errors( e, dn, to, nto, err, nerr )
} else {
add_error( err, nerr, E_NOERRORS, dn, NULLMSG );
}
return;
}
static
send_message( to )
char **to;
static void
send_message( char **to )
{
int pid;
#ifndef HAVE_WAITPID
......@@ -931,7 +944,7 @@ send_message( to )
/* parent */
if ( pid = fork() ) {
if ( (pid = fork()) != 0 ) {
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
......@@ -948,10 +961,8 @@ send_message( to )
}
}
static
send_group( group, ngroup )
Group *group;
int ngroup;
static void
send_group( Group *group, int ngroup )
{
int i, pid;
char **argv;
......@@ -979,7 +990,7 @@ send_group( group, ngroup )
/* parent */
if ( pid = fork() ) {
if ( (pid = fork()) != 0 ) {
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
......@@ -998,10 +1009,8 @@ send_group( group, ngroup )
return;
}
static
send_errors( err, nerr )
Error *err;
int nerr;
static void
send_errors( Error *err, int nerr )
{
int i, namelen;
FILE *fp;
......@@ -1097,12 +1106,8 @@ send_errors( err, nerr )
}
static
do_noemailorfax( fp, err, namelen, errtype )
FILE *fp;
Error *err;
int namelen;
int errtype;
static void
do_noemailorfax( FILE *fp, Error *err, int namelen, int errtype )
{
int i, last;
char *dn, *rdn;
......@@ -1191,11 +1196,8 @@ do_noemailorfax( fp, err, namelen, errtype )
}
/* ARGSUSED */
static
do_ambiguous( fp, err, namelen )
FILE *fp;
Error *err;
int namelen;
static void
do_ambiguous( FILE *fp, Error *err, int namelen )
{
int i, last;
char *dn, *rdn;
......@@ -1246,9 +1248,8 @@ do_ambiguous( fp, err, namelen )
}
}
static
count_values( list )
char **list;
static int
count_values( char **list )
{
int i;
......@@ -1258,11 +1259,8 @@ count_values( list )
return( i );
}
static
add_to( list, nlist, new )
char ***list;
int *nlist;
char **new;
static void
add_to( char ***list, int *nlist, char **new )
{
int i, nnew, oldnlist;
......@@ -1286,9 +1284,8 @@ add_to( list, nlist, new )
return;
}
static
isgroup( e )
LDAPMessage *e;
static int
isgroup( LDAPMessage *e )
{
int i;
char **oclist;
......@@ -1306,13 +1303,8 @@ isgroup( e )
return( 0 );
}
static
add_error( err, nerr, code, addr, msg )
Error **err;
int *nerr;
int code;
char *addr;
LDAPMessage *msg;
static void
add_error( Error **err, int *nerr, int code, char *addr, LDAPMessage *msg )
{
if ( *nerr == 0 ) {
*err = (Error *) malloc( sizeof(Error) );
......@@ -1328,11 +1320,8 @@ add_error( err, nerr, code, addr, msg )
return;
}
static
add_group( dn, list, nlist )
char *dn;
Group **list;
int *nlist;
static void
add_group( char *dn, Group **list, int *nlist )
{
int i, namelen;
char **ufn;
......@@ -1379,9 +1368,8 @@ add_group( dn, list, nlist )
return;
}
static
unbind_and_exit( rc )
int rc;
static void
unbind_and_exit( int rc )
{
int i;
......@@ -1392,8 +1380,7 @@ unbind_and_exit( rc )
}
static char *
canonical( s )
char *s;
canonical( char *s )
{
char *saves = s;
......@@ -1405,9 +1392,8 @@ canonical( s )
return( saves );
}
static
group_loop( dn )
char *dn;
static int
group_loop( char *dn )
{
int i;
static char **groups;
......@@ -1429,11 +1415,8 @@ group_loop( dn )
return( 0 );
}
static
has_attributes( e, attr1, attr2 )
LDAPMessage *e;
char *attr1;
char *attr2;
static int
has_attributes( LDAPMessage *e, char *attr1, char *attr2 )
{
char **attr;
......@@ -1451,10 +1434,7 @@ has_attributes( e, attr1, attr2 )
}
static char **
get_attributes_mail_dn( e, attr1, attr2 )
LDAPMessage *e;
char *attr1;
char *attr2; /* this one is dn-valued */
get_attributes_mail_dn( LDAPMessage *e, char *attr1, char *attr2 )
{
LDAPMessage *ee, *res;
char **vals, **dnlist, **mail;
......
......@@ -12,20 +12,25 @@
#include "portable.h"
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/syslog.h>
#include <ac/time.h>
#include <ac/unistd.h>
#include <ac/wait.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <lber.h>
#include <ldap.h>
#include "fax500.h"
#include <ldapconfig.h>
#define DEFAULT_PORT 79
......@@ -38,23 +43,20 @@ int deref;
int sizelimit;
LDAPFiltDesc *filtd;
static print_entry();
static void print_entry(LDAP *ld, LDAPMessage *e);
static