mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 09:09:54 -05:00
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern definition, for error checking. Retyped a number of functions, usually to return void. Fixed a number of printf format errors. API changes (in ldap/include): Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h. A number of `extern' declarations are left (some added by protoize), to be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind, optarg, errno.
This commit is contained in:
parent
1c91859e9b
commit
7e6ad5100c
193 changed files with 1896 additions and 2166 deletions
10
clients/fax500/fax500.h
Normal file
10
clients/fax500/fax500.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
/* 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 );
|
||||
|
|
@ -19,20 +19,16 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "fax500.h"
|
||||
#include <sys/types.h>
|
||||
#include <ac/string.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 +54,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 +124,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 +167,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 +229,4 @@ char *userinfo;
|
|||
strcat(obuf, TPCDOMAIN); /* tack on domain name */
|
||||
p = strdup(obuf);
|
||||
return(p);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,18 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "fax500.h"
|
||||
|
||||
#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>
|
||||
extern int optind, errno;
|
||||
extern char *optarg;
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
|
|
@ -48,7 +50,6 @@ char *errorsfrom = NULL;
|
|||
char *mailfrom = NULL;
|
||||
char *host = NULL;
|
||||
int hostlen = 0;
|
||||
char *faxtotpc();
|
||||
|
||||
int identity;
|
||||
#define MAIL500 1
|
||||
|
|
@ -104,27 +105,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;
|
||||
|
|
@ -132,9 +139,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 ) {
|
||||
|
|
@ -256,7 +260,7 @@ char **argv;
|
|||
*/
|
||||
|
||||
if ( numerr > 0 && numto > nargs || ngroups > 0 ) {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
umask( 077 );
|
||||
|
|
@ -304,7 +308,8 @@ char **argv;
|
|||
return( EX_OK );
|
||||
}
|
||||
|
||||
connect_to_x500()
|
||||
static int
|
||||
connect_to_x500( void )
|
||||
{
|
||||
int sizelimit = FAX_MAXAMBIGUOUS;
|
||||
int deref = LDAP_DEREF_ALWAYS;
|
||||
|
|
@ -326,16 +331,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;
|
||||
|
|
@ -577,16 +583,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
|
||||
|
|
@ -615,16 +622,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;
|
||||
|
|
@ -796,15 +804,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;
|
||||
|
|
@ -887,13 +897,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;
|
||||
|
||||
|
|
@ -905,17 +917,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;
|
||||
|
||||
|
|
@ -927,13 +939,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
|
||||
|
|
@ -942,7 +951,7 @@ send_message( to )
|
|||
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
if ( (pid = fork()) != 0 ) {
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
|
|
@ -959,10 +968,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;
|
||||
|
|
@ -990,7 +997,7 @@ send_group( group, ngroup )
|
|||
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
if ( (pid = fork()) != 0 ) {
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
|
|
@ -1009,10 +1016,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;
|
||||
|
|
@ -1108,12 +1113,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;
|
||||
|
|
@ -1202,11 +1203,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;
|
||||
|
|
@ -1257,9 +1255,8 @@ do_ambiguous( fp, err, namelen )
|
|||
}
|
||||
}
|
||||
|
||||
static
|
||||
count_values( list )
|
||||
char **list;
|
||||
static int
|
||||
count_values( char **list )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -1269,11 +1266,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;
|
||||
|
||||
|
|
@ -1297,9 +1291,8 @@ add_to( list, nlist, new )
|
|||
return;
|
||||
}
|
||||
|
||||
static
|
||||
isgroup( e )
|
||||
LDAPMessage *e;
|
||||
static int
|
||||
isgroup( LDAPMessage *e )
|
||||
{
|
||||
int i;
|
||||
char **oclist;
|
||||
|
|
@ -1317,13 +1310,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) );
|
||||
|
|
@ -1339,11 +1327,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;
|
||||
|
|
@ -1390,9 +1375,8 @@ add_group( dn, list, nlist )
|
|||
return;
|
||||
}
|
||||
|
||||
static
|
||||
unbind_and_exit( rc )
|
||||
int rc;
|
||||
static void
|
||||
unbind_and_exit( int rc )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -1403,8 +1387,7 @@ unbind_and_exit( rc )
|
|||
}
|
||||
|
||||
static char *
|
||||
canonical( s )
|
||||
char *s;
|
||||
canonical( char *s )
|
||||
{
|
||||
char *saves = s;
|
||||
|
||||
|
|
@ -1416,9 +1399,8 @@ canonical( s )
|
|||
return( saves );
|
||||
}
|
||||
|
||||
static
|
||||
group_loop( dn )
|
||||
char *dn;
|
||||
static int
|
||||
group_loop( char *dn )
|
||||
{
|
||||
int i;
|
||||
static char **groups;
|
||||
|
|
@ -1440,11 +1422,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;
|
||||
|
||||
|
|
@ -1462,10 +1441,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;
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "fax500.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/wait.h>
|
||||
|
|
@ -38,23 +38,20 @@ int deref = LDAP_DEREF_ALWAYS;
|
|||
int sizelimit = DEFAULT_SIZELIMIT;
|
||||
LDAPFiltDesc *filtd;
|
||||
|
||||
static print_entry();
|
||||
static void print_entry(LDAP *ld, LDAPMessage *e);
|
||||
|
||||
static
|
||||
usage( name )
|
||||
char *name;
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
fprintf( stderr, "usage: %s [-d debuglevel] [-x ldaphost] [-b searchbase] [-a] [-z sizelimit] [-f filterfile] searchstring\r\n", name );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
int i, rc, matches;
|
||||
char *filterfile = FILTERFILE;
|
||||
struct timeval timeout;
|
||||
char buf[10];
|
||||
char *key;
|
||||
LDAP *ld;
|
||||
|
|
@ -177,7 +174,6 @@ main (argc, argv)
|
|||
rdn++;
|
||||
if ( strcasecmp( rdn, buf ) == 0 ) {
|
||||
char **cn;
|
||||
char *s;
|
||||
int i, last;
|
||||
|
||||
cn = ldap_get_values( ld, e, "cn" );
|
||||
|
|
@ -238,16 +234,14 @@ main (argc, argv)
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static
|
||||
print_entry( ld, e )
|
||||
LDAP *ld;
|
||||
LDAPMessage *e;
|
||||
static void
|
||||
print_entry( LDAP *ld, LDAPMessage *e )
|
||||
{
|
||||
int i;
|
||||
char *dn, *rdn;
|
||||
char **ufn;
|
||||
char **title, **dept, **addr, **phone, **fax, **mail;
|
||||
char *faxmail, *org, *faxtotpc();
|
||||
char *faxmail, *org;
|
||||
|
||||
dn = ldap_get_dn( ld, e );
|
||||
ufn = ldap_explode_dn( dn, 0 );
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
|
@ -22,6 +23,8 @@
|
|||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
extern char *strdup (const char *);
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
|
|
@ -42,21 +45,19 @@ char *filterfile = FILTERFILE;
|
|||
char *templatefile = TEMPLATEFILE;
|
||||
int rdncount = FINGER_RDNCOUNT;
|
||||
|
||||
static do_query();
|
||||
static do_search();
|
||||
static do_read();
|
||||
static print_attr();
|
||||
static void do_query(void);
|
||||
static void do_search(LDAP *ld, char *buf);
|
||||
static void do_read(LDAP *ld, LDAPMessage *e);
|
||||
|
||||
static usage( name )
|
||||
char *name;
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
fprintf( stderr, "usage: %s [-l] [-x ldaphost] [-p ldapport] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
int i;
|
||||
char *myname;
|
||||
|
|
@ -133,7 +134,7 @@ char **argv;
|
|||
#endif
|
||||
}
|
||||
|
||||
if ( dosyslog && mypeer != -1 ) {
|
||||
if ( dosyslog && mypeer != (unsigned long) -1 ) {
|
||||
struct in_addr addr;
|
||||
|
||||
hp = gethostbyaddr( (char *) &mypeer, sizeof(mypeer), AF_INET );
|
||||
|
|
@ -147,7 +148,8 @@ char **argv;
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static do_query()
|
||||
static void
|
||||
do_query( void )
|
||||
{
|
||||
char buf[256];
|
||||
int len, rc, tblsize;
|
||||
|
|
@ -239,8 +241,7 @@ static do_query()
|
|||
}
|
||||
|
||||
static void
|
||||
spaces2dots( s )
|
||||
char *s;
|
||||
spaces2dots( char *s )
|
||||
{
|
||||
for ( ; *s; s++ ) {
|
||||
if ( *s == ' ' ) {
|
||||
|
|
@ -249,9 +250,8 @@ spaces2dots( s )
|
|||
}
|
||||
}
|
||||
|
||||
static do_search( ld, buf )
|
||||
LDAP *ld;
|
||||
char *buf;
|
||||
static void
|
||||
do_search( LDAP *ld, char *buf )
|
||||
{
|
||||
char *dn, *rdn;
|
||||
char **title;
|
||||
|
|
@ -265,7 +265,6 @@ char *buf;
|
|||
FINGER_SORT_ATTR,
|
||||
#endif
|
||||
0 };
|
||||
extern int strcasecmp();
|
||||
|
||||
ufn = 0;
|
||||
#ifdef FINGER_UFN
|
||||
|
|
@ -417,9 +416,8 @@ entry2textwrite( void *fp, char *buf, int len )
|
|||
}
|
||||
|
||||
|
||||
static do_read( ld, e )
|
||||
LDAP *ld;
|
||||
LDAPMessage *e;
|
||||
static void
|
||||
do_read( LDAP *ld, LDAPMessage *e )
|
||||
{
|
||||
static struct ldap_disptmpl *tmpllist;
|
||||
static char *defattrs[] = { "mail", NULL };
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/signal.h>
|
||||
|
|
@ -22,6 +23,9 @@
|
|||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
extern char *strdup (const char *);
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern int gethostname (char *, int);
|
||||
|
||||
#include <ac/setproctitle.h>
|
||||
|
||||
|
|
@ -53,24 +57,23 @@ char *templatefile = TEMPLATEFILE;
|
|||
char myhost[MAXHOSTNAMELEN];
|
||||
int myport;
|
||||
|
||||
static set_socket();
|
||||
static RETSIGTYPE wait4child();
|
||||
static do_queries();
|
||||
static do_error();
|
||||
static do_search();
|
||||
static do_read();
|
||||
extern int strcasecmp();
|
||||
static void usage ( char *name );
|
||||
static int set_socket (int port);
|
||||
static RETSIGTYPE wait4child(int sig);
|
||||
static void do_queries (int s);
|
||||
static void do_error (FILE *fp, char *s);
|
||||
static void do_search (LDAP *ld, FILE *fp, char *buf);
|
||||
static void do_read (LDAP *ld, FILE *fp, char *dn);
|
||||
|
||||
static usage( name )
|
||||
char *name;
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
fprintf( stderr, "usage: %s [-d debuglevel] [-f filterfile] [-t templatefile]\r\n\t[-a] [-l] [-p port] [-x ldaphost] [-b searchbase] [-c rdncount]\r\n", name );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
int s, ns, rc;
|
||||
int port = -1;
|
||||
|
|
@ -80,7 +83,6 @@ char **argv;
|
|||
struct hostent *hp;
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
RETSIGTYPE wait4child();
|
||||
extern char *optarg;
|
||||
|
||||
#if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE )
|
||||
|
|
@ -261,9 +263,8 @@ char **argv;
|
|||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
static
|
||||
set_socket( port )
|
||||
int port;
|
||||
static int
|
||||
set_socket( int port )
|
||||
{
|
||||
int s, one;
|
||||
struct sockaddr_in addr;
|
||||
|
|
@ -306,7 +307,7 @@ int port;
|
|||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
wait4child()
|
||||
wait4child( int sig )
|
||||
{
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
|
|
@ -325,9 +326,8 @@ wait4child()
|
|||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
}
|
||||
|
||||
static
|
||||
do_queries( s )
|
||||
int s;
|
||||
static void
|
||||
do_queries( int s )
|
||||
{
|
||||
char buf[1024], *query;
|
||||
int len;
|
||||
|
|
@ -435,10 +435,8 @@ int s;
|
|||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
static
|
||||
do_error( fp, s )
|
||||
FILE *fp;
|
||||
char *s;
|
||||
static void
|
||||
do_error( FILE *fp, char *s )
|
||||
{
|
||||
int code;
|
||||
|
||||
|
|
@ -450,11 +448,8 @@ char *s;
|
|||
fprintf( fp, ".\r\n" );
|
||||
}
|
||||
|
||||
static
|
||||
do_search( ld, fp, buf )
|
||||
LDAP *ld;
|
||||
FILE *fp;
|
||||
char *buf;
|
||||
static void
|
||||
do_search( LDAP *ld, FILE *fp, char *buf )
|
||||
{
|
||||
char *dn, *rdn;
|
||||
char **title;
|
||||
|
|
@ -567,11 +562,8 @@ entry2textwrite( void *fp, char *buf, int len )
|
|||
return( fwrite( buf, len, 1, (FILE *)fp ) == 0 ? -1 : len );
|
||||
}
|
||||
|
||||
static
|
||||
do_read( ld, fp, dn )
|
||||
LDAP *ld;
|
||||
FILE *fp;
|
||||
char *dn;
|
||||
static void
|
||||
do_read( LDAP *ld, FILE *fp, char *dn )
|
||||
{
|
||||
static struct ldap_disptmpl *tmpllist;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/signal.h>
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
|
||||
#include <ac/setproctitle.h>
|
||||
|
||||
|
|
@ -54,31 +56,35 @@ char *templatefile = TEMPLATEFILE;
|
|||
char *friendlyfile = FRIENDLYFILE;
|
||||
int rdncount = GO500GW_RDNCOUNT;
|
||||
|
||||
static set_socket();
|
||||
static RETSIGTYPE wait4child();
|
||||
static do_queries();
|
||||
static do_menu();
|
||||
static do_list();
|
||||
static do_search();
|
||||
static do_read();
|
||||
static do_help();
|
||||
static do_sizelimit();
|
||||
static do_error();
|
||||
extern int strcasecmp();
|
||||
static void usage ( char *name );
|
||||
static int set_socket (int port);
|
||||
static RETSIGTYPE wait4child(int sig);
|
||||
static void do_queries (int s);
|
||||
static char *pick_oc ( char **oclist );
|
||||
static int isnonleaf ( LDAP *ld, char **oclist, char *dn );
|
||||
static void do_menu (LDAP *ld, FILE *fp, char *dn);
|
||||
static void do_list (LDAP *ld, FILE *fp, char *dn);
|
||||
static int isoc ( char **ocl, char *oc );
|
||||
static int make_scope ( LDAP *ld, char *dn );
|
||||
static void do_search (LDAP *ld, FILE *fp, char *query);
|
||||
static int entry2textwrite( void *fp, char *buf, int len );
|
||||
static void do_read (LDAP *ld, FILE *fp, char *dn);
|
||||
static void do_help (FILE *op);
|
||||
static void do_sizelimit(FILE *fp, char type);
|
||||
static void do_error (FILE *fp, char *s);
|
||||
|
||||
char myhost[MAXHOSTNAMELEN];
|
||||
int myport = GO500GW_PORT;
|
||||
|
||||
static usage( name )
|
||||
char *name;
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
fprintf( stderr, "usage: %s [-d debuglevel] [-I] [-p port] [-P ldapport] [-l]\r\n\t[-x ldaphost] [-a] [-h helpfile] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main (int argc, char **argv )
|
||||
{
|
||||
int s, ns, rc;
|
||||
int port = -1;
|
||||
|
|
@ -88,7 +94,6 @@ char **argv;
|
|||
struct hostent *hp;
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
RETSIGTYPE wait4child();
|
||||
extern char *optarg;
|
||||
|
||||
#if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE )
|
||||
|
|
@ -285,8 +290,8 @@ char **argv;
|
|||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
static set_socket( port )
|
||||
int port;
|
||||
static int
|
||||
set_socket( int port )
|
||||
{
|
||||
int s, one;
|
||||
struct sockaddr_in addr;
|
||||
|
|
@ -330,7 +335,7 @@ int port;
|
|||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
wait4child()
|
||||
wait4child( int sig )
|
||||
{
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
|
|
@ -349,8 +354,8 @@ wait4child()
|
|||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
}
|
||||
|
||||
static do_queries( s )
|
||||
int s;
|
||||
static void
|
||||
do_queries( int s )
|
||||
{
|
||||
char buf[1024], *query;
|
||||
int len;
|
||||
|
|
@ -456,7 +461,7 @@ int s;
|
|||
break;
|
||||
|
||||
case 'S': /* search */
|
||||
do_search( ld, fp, query, 1 );
|
||||
do_search( ld, fp, query );
|
||||
break;
|
||||
|
||||
case 'M': /* X.500 menu */
|
||||
|
|
@ -475,8 +480,8 @@ int s;
|
|||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
static char *pick_oc( oclist )
|
||||
char **oclist;
|
||||
static char *
|
||||
pick_oc( char **oclist )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -493,10 +498,8 @@ char **oclist;
|
|||
return( "unknown" );
|
||||
}
|
||||
|
||||
static isnonleaf( ld, oclist, dn )
|
||||
LDAP *ld;
|
||||
char **oclist;
|
||||
char *dn;
|
||||
static int
|
||||
isnonleaf( LDAP *ld, char **oclist, char *dn )
|
||||
{
|
||||
int i, quipuobject = 0;
|
||||
|
||||
|
|
@ -547,10 +550,8 @@ char *dn;
|
|||
#endif
|
||||
}
|
||||
|
||||
static do_menu( ld, fp, dn )
|
||||
LDAP *ld;
|
||||
FILE *fp;
|
||||
char *dn;
|
||||
static void
|
||||
do_menu( LDAP *ld, FILE *fp, char *dn )
|
||||
{
|
||||
char **s;
|
||||
char *rdn = NULL;
|
||||
|
|
@ -580,10 +581,8 @@ char *dn;
|
|||
ldap_free_friendlymap( &fm );
|
||||
}
|
||||
|
||||
static do_list( ld, fp, dn )
|
||||
LDAP *ld;
|
||||
FILE *fp;
|
||||
char *dn;
|
||||
static void
|
||||
do_list( LDAP *ld, FILE *fp, char *dn )
|
||||
{
|
||||
int rc;
|
||||
LDAPMessage *e, *res;
|
||||
|
|
@ -658,9 +657,8 @@ char *dn;
|
|||
}
|
||||
}
|
||||
|
||||
static isoc( ocl, oc )
|
||||
char **ocl;
|
||||
char *oc;
|
||||
static int
|
||||
isoc( char **ocl, char *oc )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -672,9 +670,8 @@ char *oc;
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static int make_scope( ld, dn )
|
||||
LDAP *ld;
|
||||
char *dn;
|
||||
static int
|
||||
make_scope( LDAP *ld, char *dn )
|
||||
{
|
||||
int scope;
|
||||
char **oc;
|
||||
|
|
@ -705,10 +702,8 @@ char *dn;
|
|||
return( scope );
|
||||
}
|
||||
|
||||
static do_search( ld, fp, query )
|
||||
LDAP *ld;
|
||||
FILE *fp;
|
||||
char *query;
|
||||
static void
|
||||
do_search( LDAP *ld, FILE *fp, char *query )
|
||||
{
|
||||
int deref;
|
||||
int scope;
|
||||
|
|
@ -778,7 +773,7 @@ char *query;
|
|||
!= LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
fprintf(fp, "0An error occurred (explanation)\tE%d\t%s\t%d\r\n",
|
||||
rc, myhost, myport );
|
||||
return( 1 );
|
||||
return;
|
||||
}
|
||||
if ( (count = ldap_count_entries( ld, res )) != 0 )
|
||||
break;
|
||||
|
|
@ -791,7 +786,7 @@ char *query;
|
|||
#endif
|
||||
|
||||
if ( count == 0 ) {
|
||||
return( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( count == 1 ) {
|
||||
|
|
@ -803,10 +798,10 @@ char *query;
|
|||
dn = ldap_get_dn( ld, e );
|
||||
|
||||
if ( isnonleaf( ld, oc, dn ) ) {
|
||||
rc = do_menu( ld, fp, dn );
|
||||
do_menu( ld, fp, dn );
|
||||
|
||||
free( dn );
|
||||
return( rc );
|
||||
return;
|
||||
}
|
||||
|
||||
free( dn );
|
||||
|
|
@ -851,10 +846,8 @@ entry2textwrite( void *fp, char *buf, int len )
|
|||
return( fwrite( buf, len, 1, (FILE *)fp ) == 0 ? -1 : len );
|
||||
}
|
||||
|
||||
static do_read( ld, fp, dn )
|
||||
LDAP *ld;
|
||||
FILE *fp;
|
||||
char *dn;
|
||||
static void
|
||||
do_read( LDAP *ld, FILE *fp, char *dn )
|
||||
{
|
||||
static struct ldap_disptmpl *tmpllist;
|
||||
|
||||
|
|
@ -876,8 +869,8 @@ char *dn;
|
|||
}
|
||||
}
|
||||
|
||||
static do_help( op )
|
||||
FILE *op;
|
||||
static void
|
||||
do_help( FILE *op )
|
||||
{
|
||||
FILE *fp;
|
||||
char line[BUFSIZ];
|
||||
|
|
@ -896,9 +889,8 @@ FILE *op;
|
|||
fclose( fp );
|
||||
}
|
||||
|
||||
static do_sizelimit( fp, type )
|
||||
FILE *fp;
|
||||
char type;
|
||||
static void
|
||||
do_sizelimit( FILE *fp, char type )
|
||||
{
|
||||
if ( type == 'S' ) {
|
||||
fprintf( fp, "The query you specified was not specific enough, causing a size limit\r\n" );
|
||||
|
|
@ -914,9 +906,8 @@ char type;
|
|||
fprintf( fp, ".\r\n" );
|
||||
}
|
||||
|
||||
static do_error( fp, s )
|
||||
FILE *fp;
|
||||
char *s;
|
||||
static void
|
||||
do_error( FILE *fp, char *s )
|
||||
{
|
||||
int code;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/wait.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
extern int optind, errno;
|
||||
extern char *optarg;
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
|
|
@ -122,27 +126,32 @@ static char *attrs[] = { "objectClass", "title", "postaladdress",
|
|||
"moderator", "onVacation", "uid",
|
||||
"suppressNoEmailError", NULL };
|
||||
|
||||
static do_address();
|
||||
static do_group();
|
||||
static do_group_members();
|
||||
static send_message();
|
||||
static send_errors();
|
||||
static do_noemail();
|
||||
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();
|
||||
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_noemail( FILE *fp, Error *err, int namelen );
|
||||
static void do_ambiguous( FILE *fp, Error *err, int namelen );
|
||||
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 );
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
void do_group_errors( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr );
|
||||
void do_group_request( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr );
|
||||
void do_group_owner( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr );
|
||||
void add_member( char *gdn, char *dn, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr, char **suppress );
|
||||
|
||||
int
|
||||
main ( int argc, char **argv )
|
||||
{
|
||||
char *myname;
|
||||
char **tolist;
|
||||
|
|
@ -150,9 +159,6 @@ char **argv;
|
|||
Group *togroups;
|
||||
int numto, ngroups, numerr, nargs;
|
||||
int i, j;
|
||||
FILE *fp;
|
||||
extern int optind, errno;
|
||||
extern char *optarg;
|
||||
|
||||
if ( (myname = strrchr( argv[0], '/' )) == NULL )
|
||||
myname = strdup( argv[0] );
|
||||
|
|
@ -286,7 +292,7 @@ char **argv;
|
|||
*/
|
||||
|
||||
if ( numerr > 0 && numto > nargs || ngroups > 0 ) {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
umask( 077 );
|
||||
|
|
@ -343,7 +349,8 @@ char **argv;
|
|||
return( EX_OK );
|
||||
}
|
||||
|
||||
connect_to_x500()
|
||||
static int
|
||||
connect_to_x500( void )
|
||||
{
|
||||
int opt;
|
||||
|
||||
|
|
@ -365,10 +372,8 @@ connect_to_x500()
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static
|
||||
mailcmp( a, b )
|
||||
char *a;
|
||||
char *b;
|
||||
static int
|
||||
mailcmp( char *a, char *b )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -391,16 +396,17 @@ mailcmp( a, b )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -692,20 +698,19 @@ do_address( name, to, nto, togroups, ngroups, err, nerr, type )
|
|||
ldap_value_free( uid );
|
||||
}
|
||||
free( dn );
|
||||
|
||||
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
|
||||
)
|
||||
{
|
||||
int i;
|
||||
char **moderator;
|
||||
|
|
@ -763,16 +768,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, anymembers;
|
||||
char *ndn;
|
||||
|
|
@ -907,20 +913,20 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
|
|||
if ( ! anymembers ) {
|
||||
add_error( err, nerr, E_NOMEMBERS, dn, NULLMSG );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
add_member( gdn, dn, to, nto, togroups, ngroups, err, nerr, suppress )
|
||||
char *gdn;
|
||||
char *dn;
|
||||
char ***to;
|
||||
int *nto;
|
||||
Group **togroups;
|
||||
int *ngroups;
|
||||
Error **err;
|
||||
int *nerr;
|
||||
char **suppress;
|
||||
void
|
||||
add_member(
|
||||
char *gdn,
|
||||
char *dn,
|
||||
char ***to,
|
||||
int *nto,
|
||||
Group **togroups,
|
||||
int *ngroups,
|
||||
Error **err,
|
||||
int *nerr,
|
||||
char **suppress
|
||||
)
|
||||
{
|
||||
char *ndn;
|
||||
char **mail;
|
||||
|
|
@ -977,17 +983,17 @@ add_member( gdn, dn, to, nto, togroups, ngroups, err, nerr, suppress )
|
|||
}
|
||||
|
||||
free( ndn );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
do_group_request( e, dn, to, nto, err, nerr )
|
||||
LDAPMessage *e;
|
||||
char *dn;
|
||||
char ***to;
|
||||
int *nto;
|
||||
Error **err;
|
||||
int *nerr;
|
||||
void
|
||||
do_group_request(
|
||||
LDAPMessage *e,
|
||||
char *dn,
|
||||
char ***to,
|
||||
int *nto,
|
||||
Error **err,
|
||||
int *nerr
|
||||
)
|
||||
{
|
||||
char **requeststo;
|
||||
|
||||
|
|
@ -999,17 +1005,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;
|
||||
void
|
||||
do_group_errors(
|
||||
LDAPMessage *e,
|
||||
char *dn,
|
||||
char ***to,
|
||||
int *nto,
|
||||
Error **err,
|
||||
int *nerr
|
||||
)
|
||||
{
|
||||
char **errorsto;
|
||||
|
||||
|
|
@ -1021,17 +1027,17 @@ do_group_errors( e, dn, to, nto, err, nerr )
|
|||
} else {
|
||||
add_error( err, nerr, E_NOERRORS, dn, NULLMSG );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
do_group_owner( e, dn, to, nto, err, nerr )
|
||||
LDAPMessage *e;
|
||||
char *dn;
|
||||
char ***to;
|
||||
int *nto;
|
||||
Error **err;
|
||||
int *nerr;
|
||||
void
|
||||
do_group_owner(
|
||||
LDAPMessage *e,
|
||||
char *dn,
|
||||
char ***to,
|
||||
int *nto,
|
||||
Error **err,
|
||||
int *nerr
|
||||
)
|
||||
{
|
||||
char **owner;
|
||||
|
||||
|
|
@ -1041,12 +1047,10 @@ do_group_owner( e, dn, to, nto, err, nerr )
|
|||
} else {
|
||||
add_error( err, nerr, E_NOOWNER, dn, NULLMSG );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
send_message( to )
|
||||
char **to;
|
||||
static void
|
||||
send_message( char **to )
|
||||
{
|
||||
int pid;
|
||||
#ifndef HAVE_WAITPID
|
||||
|
|
@ -1067,7 +1071,7 @@ send_message( to )
|
|||
}
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
if ( (pid = fork()) != 0 ) {
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
|
|
@ -1084,10 +1088,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;
|
||||
|
|
@ -1127,7 +1129,7 @@ send_group( group, ngroup )
|
|||
}
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
if ( (pid = fork()) != 0 ) {
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
|
|
@ -1142,14 +1144,10 @@ send_group( group, ngroup )
|
|||
exit( EX_TEMPFAIL );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
send_errors( err, nerr )
|
||||
Error *err;
|
||||
int nerr;
|
||||
static void
|
||||
send_errors( Error *err, int nerr )
|
||||
{
|
||||
int pid, i, namelen;
|
||||
FILE *fp;
|
||||
|
|
@ -1190,7 +1188,7 @@ send_errors( err, nerr )
|
|||
exit( EX_TEMPFAIL );
|
||||
}
|
||||
|
||||
if ( pid = fork() ) {
|
||||
if ( (pid = fork()) != 0 ) {
|
||||
if ( (fp = fdopen( fd[1], "w" )) == NULL ) {
|
||||
syslog( LOG_ALERT, "cannot fdopen pipe" );
|
||||
exit( EX_TEMPFAIL );
|
||||
|
|
@ -1293,15 +1291,10 @@ send_errors( err, nerr )
|
|||
|
||||
exit( EX_TEMPFAIL );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
do_noemail( fp, err, namelen )
|
||||
FILE *fp;
|
||||
Error *err;
|
||||
int namelen;
|
||||
static void
|
||||
do_noemail( FILE *fp, Error *err, int namelen )
|
||||
{
|
||||
int i, last;
|
||||
char *dn, *rdn;
|
||||
|
|
@ -1385,11 +1378,8 @@ do_noemail( fp, err, namelen )
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
@ -1440,9 +1430,8 @@ do_ambiguous( fp, err, namelen )
|
|||
}
|
||||
}
|
||||
|
||||
static
|
||||
count_values( list )
|
||||
char **list;
|
||||
static int
|
||||
count_values( char **list )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -1452,11 +1441,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;
|
||||
|
||||
|
|
@ -1475,13 +1461,10 @@ add_to( list, nlist, new )
|
|||
for ( i = 0; i < nnew; i++ )
|
||||
(*list)[i + oldnlist] = strdup( new[i] );
|
||||
(*list)[*nlist] = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
isgroup( e )
|
||||
LDAPMessage *e;
|
||||
static int
|
||||
isgroup( LDAPMessage *e )
|
||||
{
|
||||
int i;
|
||||
char **oclist;
|
||||
|
|
@ -1499,13 +1482,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) );
|
||||
|
|
@ -1517,15 +1495,10 @@ add_error( err, nerr, code, addr, msg )
|
|||
(*err)[*nerr].e_addr = strdup( addr );
|
||||
(*err)[*nerr].e_msg = msg;
|
||||
(*nerr)++;
|
||||
|
||||
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;
|
||||
|
|
@ -1568,13 +1541,10 @@ add_group( dn, list, nlist )
|
|||
(*nlist)++;
|
||||
|
||||
ldap_value_free( ufn );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
unbind_and_exit( rc )
|
||||
int rc;
|
||||
static void
|
||||
unbind_and_exit( int rc )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -1585,8 +1555,7 @@ unbind_and_exit( rc )
|
|||
}
|
||||
|
||||
static char *
|
||||
canonical( s )
|
||||
char *s;
|
||||
canonical( char *s )
|
||||
{
|
||||
char *saves = s;
|
||||
|
||||
|
|
@ -1598,9 +1567,8 @@ canonical( s )
|
|||
return( saves );
|
||||
}
|
||||
|
||||
static
|
||||
group_loop( dn )
|
||||
char *dn;
|
||||
static int
|
||||
group_loop( char *dn )
|
||||
{
|
||||
int i;
|
||||
static char **groups;
|
||||
|
|
@ -1622,11 +1590,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;
|
||||
|
||||
|
|
@ -1644,10 +1609,11 @@ 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 /* this one is dn-valued */
|
||||
)
|
||||
{
|
||||
LDAPMessage *ee, *res;
|
||||
char **vals, **dnlist, **mail, **grname, **graddr;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
|
|
@ -20,13 +21,9 @@
|
|||
#include "ldapconfig.h"
|
||||
#include "rcpt500.h"
|
||||
|
||||
extern int dosyslog;
|
||||
|
||||
|
||||
int
|
||||
help_cmd( msgp, reply )
|
||||
struct msginfo *msgp;
|
||||
char *reply;
|
||||
help_cmd(struct msginfo *msgp, char *reply)
|
||||
{
|
||||
int fd, len;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
extern char *strdup (const char *);
|
||||
extern char *strstr (const char *, const char *);
|
||||
|
||||
#include "ldapconfig.h"
|
||||
#include "rcpt500.h"
|
||||
|
|
@ -32,24 +34,23 @@ char *searchbase = NULL;
|
|||
char *dapuser = NULL;
|
||||
char *filterfile = FILTERFILE;
|
||||
char *templatefile = TEMPLATEFILE;
|
||||
char reply[ MAXSIZE * RCPT500_LISTLIMIT ];
|
||||
|
||||
static char reply[ MAXSIZE * RCPT500_LISTLIMIT ];
|
||||
|
||||
|
||||
/*
|
||||
* functions
|
||||
*/
|
||||
int read_msg();
|
||||
char *read_hdr();
|
||||
int send_reply();
|
||||
static int read_msg(FILE *fp, struct msginfo *msgp);
|
||||
static char *read_hdr(FILE *fp, int off, char *buf, int MAXSIZEe, char **ln_p);
|
||||
static int send_reply(struct msginfo *msgp, char *body);
|
||||
static int find_command(char *text, char **argp);
|
||||
|
||||
/*
|
||||
* main is invoked by sendmail via the alias file
|
||||
* the entire incoming message gets piped to our standard input
|
||||
*/
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
char *prog, *usage = "%s [-l] [-U] [-h ldaphost] [-p ldapport] [-b searchbase] [-a] [-z sizelimit] [-u dapuser] [-f filterfile] [-t templatefile] [-c rdncount]\n";
|
||||
struct msginfo msg;
|
||||
|
|
@ -168,10 +169,8 @@ main( argc, argv )
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
read_msg( fp, msgp )
|
||||
FILE *fp;
|
||||
struct msginfo *msgp;
|
||||
static int
|
||||
read_msg( FILE *fp, struct msginfo *msgp )
|
||||
{
|
||||
char buf[ MAXSIZE ], *line;
|
||||
int command = -1;
|
||||
|
|
@ -231,13 +230,8 @@ read_msg( fp, msgp )
|
|||
}
|
||||
|
||||
|
||||
char *
|
||||
read_hdr( fp, offset, buf, MAXSIZEe, linep )
|
||||
FILE *fp;
|
||||
int offset;
|
||||
char *buf;
|
||||
int MAXSIZEe;
|
||||
char **linep;
|
||||
static char *
|
||||
read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep )
|
||||
{
|
||||
char *hdr;
|
||||
|
||||
|
|
@ -272,10 +266,8 @@ read_hdr( fp, offset, buf, MAXSIZEe, linep )
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
send_reply( msgp, body )
|
||||
struct msginfo *msgp;
|
||||
char *body;
|
||||
static int
|
||||
send_reply( struct msginfo *msgp, char *body )
|
||||
{
|
||||
char buf[ MAXSIZE ];
|
||||
FILE *cmdpipe;
|
||||
|
|
@ -353,10 +345,8 @@ send_reply( msgp, body )
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
find_command( text, argp )
|
||||
char *text;
|
||||
char **argp;
|
||||
static int
|
||||
find_command( char *text, char **argp )
|
||||
{
|
||||
int i;
|
||||
char *s, *p;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,13 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
|
@ -23,30 +25,19 @@
|
|||
#include "rcpt500.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
extern int dosyslog;
|
||||
extern int do_cldap;
|
||||
extern int rdncount;
|
||||
extern int derefaliases;
|
||||
extern int sizelimit;
|
||||
extern int ldapport;
|
||||
extern char *ldaphost;
|
||||
extern char *searchbase;
|
||||
extern char *dapuser;
|
||||
extern char *filterfile;
|
||||
extern char *templatefile;
|
||||
|
||||
static char buf[ MAXSIZE ];
|
||||
static char *errpreface = "Your query failed: ";
|
||||
|
||||
extern int strcasecmp();
|
||||
|
||||
void close_ldap();
|
||||
static void close_ldap(LDAP *ld);
|
||||
static void append_entry_list(char *rep, char *qu, LDAP *ld, LDAPMessage *msg);
|
||||
static int append_text(void *reply, char *text, int len);
|
||||
static int do_read (LDAP *ld, char *dn, char *rep, struct ldap_disptmpl *tmp);
|
||||
static void report_ldap_err (LDAP *ldp, char *reply);
|
||||
static void remove_trailing_space (char *s);
|
||||
|
||||
|
||||
int
|
||||
query_cmd( msgp, reply )
|
||||
struct msginfo *msgp;
|
||||
char *reply;
|
||||
query_cmd( struct msginfo *msgp, char *reply )
|
||||
{
|
||||
LDAP *ldp;
|
||||
LDAPMessage *ldmsgp, *entry;
|
||||
|
|
@ -224,7 +215,7 @@ query_cmd( msgp, reply )
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
close_ldap( LDAP *ld )
|
||||
{
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
|
|
@ -236,11 +227,8 @@ close_ldap( LDAP *ld )
|
|||
}
|
||||
|
||||
|
||||
append_entry_list( reply, query, ldp, ldmsgp )
|
||||
char *reply;
|
||||
char *query;
|
||||
LDAP *ldp;
|
||||
LDAPMessage *ldmsgp;
|
||||
static void
|
||||
append_entry_list( char *reply, char *query, LDAP *ldp, LDAPMessage *ldmsgp )
|
||||
{
|
||||
LDAPMessage *e;
|
||||
char *dn, *rdn, *s, **title;
|
||||
|
|
@ -301,23 +289,16 @@ append_entry_list( reply, query, ldp, ldmsgp )
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
append_text( reply, text, len )
|
||||
char *reply;
|
||||
char *text;
|
||||
int len;
|
||||
static int
|
||||
append_text( void *reply, char *text, int len )
|
||||
{
|
||||
strcat( reply, text );
|
||||
strcat( (char *) reply, text );
|
||||
return( len );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
do_read( ldp, dn, reply, tmpll )
|
||||
LDAP *ldp;
|
||||
char *dn;
|
||||
char *reply;
|
||||
struct ldap_disptmpl *tmpll;
|
||||
static int
|
||||
do_read( LDAP *ldp, char *dn, char *reply, struct ldap_disptmpl *tmpll )
|
||||
{
|
||||
int rc;
|
||||
static char *maildefvals[] = { "None registered in this service", NULL };
|
||||
|
|
@ -333,9 +314,8 @@ do_read( ldp, dn, reply, tmpll )
|
|||
}
|
||||
|
||||
|
||||
report_ldap_err( ldp, reply )
|
||||
LDAP *ldp;
|
||||
char *reply;
|
||||
static void
|
||||
report_ldap_err( LDAP *ldp, char *reply )
|
||||
{
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ldp, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
|
@ -346,8 +326,8 @@ report_ldap_err( ldp, reply )
|
|||
}
|
||||
|
||||
|
||||
remove_trailing_space( s )
|
||||
char *s;
|
||||
static void
|
||||
remove_trailing_space( char *s )
|
||||
{
|
||||
char *p = s + strlen( s ) - 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ struct msginfo {
|
|||
};
|
||||
|
||||
struct command {
|
||||
char *cmd_text; /* text for command, e.g. "HELP" */
|
||||
int (*cmd_handler)LDAP_P(()); /* pointer to handler function */
|
||||
char *cmd_text; /* text for command, e.g. "HELP" */
|
||||
/* pointer to handler function */
|
||||
int (*cmd_handler) LDAP_P((struct msginfo *msgp, char *reply));
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -31,12 +32,28 @@ struct command {
|
|||
/*
|
||||
* functions
|
||||
*/
|
||||
int help_cmd LDAP_P(());
|
||||
int query_cmd LDAP_P(());
|
||||
int help_cmd LDAP_P((struct msginfo *msgp, char *reply));
|
||||
int query_cmd LDAP_P((struct msginfo *msgp, char *reply));
|
||||
|
||||
/*
|
||||
* externs
|
||||
*/
|
||||
|
||||
/* cmds.c */
|
||||
extern struct command cmds[];
|
||||
/* main.c */
|
||||
extern int dosyslog;
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
extern int do_cldap;
|
||||
#endif
|
||||
extern int derefaliases;
|
||||
extern int sizelimit;
|
||||
extern int rdncount;
|
||||
extern int ldapport;
|
||||
extern char *ldaphost;
|
||||
extern char *searchbase;
|
||||
extern char *dapuser;
|
||||
extern char *filterfile;
|
||||
extern char *templatefile;
|
||||
|
||||
LDAP_END_DECL
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
|
@ -20,10 +21,6 @@ static int ldapport = 0;
|
|||
static int not, verbose, contoper;
|
||||
static LDAP *ld;
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
extern int ldap_debug, lber_debug;
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
|
||||
realloc( ptr, size ))
|
||||
|
||||
|
|
@ -32,9 +29,7 @@ static int dodelete LDAP_P((
|
|||
char *dn));
|
||||
|
||||
int
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
char *usage = "usage: %s [-n] [-v] [-k] [-d debug-level] [-f file] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [dn]...\n";
|
||||
char buf[ 4096 ];
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
@ -30,10 +31,6 @@ static int ldapport = 0;
|
|||
static int new, replace, not, verbose, contoper, force, valsfromfiles;
|
||||
static LDAP *ld;
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
extern int ldap_debug, lber_debug;
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
|
||||
realloc( ptr, size ))
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
|
@ -20,10 +21,6 @@ static int ldapport = 0;
|
|||
static int not, verbose, contoper;
|
||||
static LDAP *ld;
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
extern int ldap_debug, lber_debug;
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
|
||||
realloc( ptr, size ))
|
||||
|
||||
|
|
@ -34,9 +31,7 @@ static int domodrdn LDAP_P((
|
|||
int remove)); /* flag: remove old RDN */
|
||||
|
||||
int
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *usage = "usage: %s [-nvkc] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile | dn newrdn ]\n";
|
||||
char *myname,*infile, *entrydn, *rdn, buf[ 4096 ];
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern char *mktemp(char *);
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
|
@ -13,13 +16,9 @@
|
|||
|
||||
#define DEFSEP "="
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
extern int ldap_debug, lber_debug;
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
|
||||
static void usage( s )
|
||||
char *s;
|
||||
static void
|
||||
usage( char *s )
|
||||
{
|
||||
fprintf( stderr, "usage: %s [options] filter [attributes...]\nwhere:\n", s );
|
||||
fprintf( stderr, " filter\tRFC-1558 compliant LDAP search filter\n" );
|
||||
|
|
@ -85,9 +84,7 @@ static int skipsortattr = 0;
|
|||
static int verbose, not, includeufn, allow_binary, vals2tmp, ldif;
|
||||
|
||||
int
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
char *infile, *filtpattern, **attrs, line[ BUFSIZ ];
|
||||
FILE *fp;
|
||||
|
|
@ -373,8 +370,6 @@ static int dosearch(
|
|||
ldap_perror( ld, "ldap_search" );
|
||||
}
|
||||
if ( sortattr != NULL ) {
|
||||
extern int strcasecmp();
|
||||
|
||||
(void) ldap_sort_entries( ld, &res,
|
||||
( *sortattr == '\0' ) ? NULL : sortattr, strcasecmp );
|
||||
matches = 0;
|
||||
|
|
@ -410,7 +405,6 @@ void print_entry(
|
|||
BerElement *ber;
|
||||
struct berval **bvals;
|
||||
FILE *tmpfp;
|
||||
extern char *mktemp();
|
||||
|
||||
dn = ldap_get_dn( ld, entry );
|
||||
if ( ldif ) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#include <ac/krb.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
|
|
@ -30,25 +32,17 @@
|
|||
|
||||
#include "ud.h"
|
||||
|
||||
extern LDAP *ld; /* our LDAP descriptor */
|
||||
extern int verbose; /* verbosity indicator */
|
||||
extern char *mygetpass(); /* getpass() passwds are too short */
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug; /* debug flag */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KERBEROS
|
||||
static char tktpath[20]; /* ticket file path */
|
||||
static int kinit();
|
||||
static int valid_tgt();
|
||||
#endif
|
||||
|
||||
static void set_bound_dn();
|
||||
static void set_bound_dn(char *s);
|
||||
|
||||
auth(who, implicit)
|
||||
char *who;
|
||||
int implicit;
|
||||
|
||||
int
|
||||
auth( char *who, int implicit )
|
||||
{
|
||||
int rc; /* return code from ldap_bind() */
|
||||
char *passwd = NULL; /* returned by mygetpass() */
|
||||
|
|
@ -71,13 +65,6 @@ int implicit;
|
|||
static char prompt[MED_BUF_SIZE]; /* place for us to sprintf the prompt */
|
||||
static char name[MED_BUF_SIZE]; /* place to store the user's name */
|
||||
static char password[MED_BUF_SIZE]; /* password entered by user */
|
||||
extern struct entry Entry; /* look here for a name if needed */
|
||||
extern LDAPMessage *find(); /* for looking up 'name' */
|
||||
extern char *search_base; /* for printing later */
|
||||
extern char *default_bind_object; /* bind as this on failure */
|
||||
extern void printbase(); /* used to pretty-print a base */
|
||||
extern int bind_status;
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -308,8 +295,8 @@ int implicit;
|
|||
#define FIVEMINS ( 5 * 60 )
|
||||
#define TGT "krbtgt"
|
||||
|
||||
static void str2upper( s )
|
||||
char *s;
|
||||
static void
|
||||
str2upper( char *s )
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
|
@ -319,8 +306,8 @@ static void str2upper( s )
|
|||
}
|
||||
|
||||
|
||||
static valid_tgt( names )
|
||||
char **names;
|
||||
static int
|
||||
valid_tgt( char **names )
|
||||
{
|
||||
int i;
|
||||
char name[ ANAME_SZ ], inst[ INST_SZ ], realm[ REALM_SZ ];
|
||||
|
|
@ -360,9 +347,7 @@ static char *kauth_name;
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
krbgetpass( user, inst, realm, pw, key )
|
||||
char *user, *inst, *realm, *pw;
|
||||
C_Block key;
|
||||
krbgetpass( char *user, char *inst, char *realm, char *pw, C_Block key )
|
||||
{
|
||||
char *p, lcrealm[ REALM_SZ ], prompt[256], *passwd;
|
||||
|
||||
|
|
@ -392,8 +377,8 @@ krbgetpass( user, inst, realm, pw, key )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static kinit( kname )
|
||||
char *kname;
|
||||
static int
|
||||
kinit( char *kname )
|
||||
{
|
||||
int rc;
|
||||
char name[ ANAME_SZ ], inst[ INST_SZ ], realm[ REALM_SZ ];
|
||||
|
|
@ -432,7 +417,8 @@ static kinit( kname )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
void destroy_tickets(void)
|
||||
void
|
||||
destroy_tickets( void )
|
||||
{
|
||||
if ( *tktpath != '\0' ) {
|
||||
unlink( tktpath );
|
||||
|
|
@ -440,11 +426,9 @@ void destroy_tickets(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void set_bound_dn(char *s)
|
||||
static void
|
||||
set_bound_dn( char *s )
|
||||
{
|
||||
extern void Free();
|
||||
extern char *bound_dn;
|
||||
|
||||
if (bound_dn != NULL)
|
||||
Free(bound_dn);
|
||||
bound_dn = (s == NULL) ? NULL : strdup(s);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,12 @@
|
|||
|
||||
#include <ac/signal.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/wait.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
extern char * mktemp(char *);
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
|
|
@ -31,33 +35,22 @@
|
|||
#include <ldap.h>
|
||||
#include <ldapconfig.h>
|
||||
#include "ud.h"
|
||||
extern void *Malloc();
|
||||
|
||||
extern struct entry Entry;
|
||||
extern int verbose;
|
||||
extern LDAP *ld;
|
||||
|
||||
extern LDAPMessage *find();
|
||||
|
||||
static int load_editor();
|
||||
static int modifiable();
|
||||
static int print_attrs_and_values();
|
||||
static int ovalues();
|
||||
static int write_entry();
|
||||
static int load_editor( void );
|
||||
static int modifiable( char *s, short flag );
|
||||
static int print_attrs_and_values( FILE *fp, struct attribute *attrs, short flag );
|
||||
static int ovalues( char *attr );
|
||||
static void write_entry( void );
|
||||
|
||||
static char *entry_temp_file;
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
#endif
|
||||
|
||||
edit(who)
|
||||
char *who;
|
||||
void
|
||||
edit( char *who )
|
||||
{
|
||||
LDAPMessage *mp; /* returned from find() */
|
||||
char *dn, **rdns; /* distinguished name */
|
||||
char name[MED_BUF_SIZE]; /* entry to modify */
|
||||
extern int bind_status;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -111,19 +104,18 @@ char *who;
|
|||
(void) ldap_value_free(rdns);
|
||||
if (load_editor() < 0)
|
||||
return;
|
||||
(void) write_entry();
|
||||
write_entry();
|
||||
(void) unlink(entry_temp_file);
|
||||
ldap_uncache_entry(ld, Entry.DN);
|
||||
return;
|
||||
}
|
||||
|
||||
static load_editor()
|
||||
static int
|
||||
load_editor( void )
|
||||
{
|
||||
FILE *fp;
|
||||
char *cp, *editor = UD_DEFAULT_EDITOR;
|
||||
static char template[MED_BUF_SIZE];
|
||||
extern char * mktemp();
|
||||
extern int isgroup(), fatal();
|
||||
int pid;
|
||||
int status;
|
||||
int rc;
|
||||
|
|
@ -208,10 +200,8 @@ static load_editor()
|
|||
return(0);
|
||||
}
|
||||
|
||||
static int print_attrs_and_values(fp, attrs, flag)
|
||||
FILE *fp;
|
||||
struct attribute attrs[];
|
||||
short flag;
|
||||
static int
|
||||
print_attrs_and_values( FILE *fp, struct attribute *attrs, short int flag )
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
|
|
@ -231,12 +221,10 @@ short flag;
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static modifiable(s, flag)
|
||||
char *s;
|
||||
short flag;
|
||||
static int
|
||||
modifiable( char *s, short int flag )
|
||||
{
|
||||
register int i;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++) {
|
||||
if (strcasecmp(s, attrlist[i].quipu_name))
|
||||
|
|
@ -249,7 +237,8 @@ short flag;
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
static write_entry()
|
||||
static void
|
||||
write_entry( void )
|
||||
{
|
||||
int i = 0, j, number_of_values = -1;
|
||||
|
||||
|
|
@ -259,9 +248,6 @@ static write_entry()
|
|||
LDAPMod *mods[MAX_ATTRS + 1];
|
||||
LDAPMod *modp = NULL;
|
||||
|
||||
extern char * code_to_str();
|
||||
extern void free_mod_struct();
|
||||
|
||||
/* parse the file and write the values to the Directory */
|
||||
if ((fp = fopen(entry_temp_file, "r")) == NULL) {
|
||||
perror("fopen");
|
||||
|
|
@ -455,8 +441,8 @@ static write_entry()
|
|||
return;
|
||||
}
|
||||
|
||||
static ovalues(attr)
|
||||
char *attr;
|
||||
static int
|
||||
ovalues( char *attr )
|
||||
{
|
||||
struct attribute *ap;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,28 +13,23 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
||||
#include "ud.h"
|
||||
|
||||
extern char *search_base; /* search base */
|
||||
extern int verbose; /* verbose mode flag */
|
||||
extern LDAP *ld; /* our ldap descriptor */
|
||||
|
||||
static int num_picked = 0; /* used when user picks entry at More prompt */
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug; /* debug flag */
|
||||
#endif
|
||||
|
||||
vrfy(dn)
|
||||
char *dn;
|
||||
int
|
||||
vrfy( char *dn )
|
||||
{
|
||||
LDAPMessage *results;
|
||||
static char *attrs[2] = { "objectClass", NULL };
|
||||
|
|
@ -61,11 +56,8 @@ char *dn;
|
|||
}
|
||||
|
||||
|
||||
static LDAPMessage * disambiguate( result, matches, read_attrs, who )
|
||||
LDAPMessage *result;
|
||||
int matches;
|
||||
char **read_attrs;
|
||||
char *who;
|
||||
static LDAPMessage *
|
||||
disambiguate( LDAPMessage *result, int matches, char **read_attrs, char *who )
|
||||
{
|
||||
int choice; /* entry that user chooses */
|
||||
int i;
|
||||
|
|
@ -74,7 +66,6 @@ char *who;
|
|||
char *name = NULL; /* DN to lookup */
|
||||
LDAPMessage *mp;
|
||||
int ld_errno = 0;
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -161,9 +152,8 @@ char *who;
|
|||
}
|
||||
}
|
||||
|
||||
LDAPMessage * find(who, quiet)
|
||||
char *who;
|
||||
int quiet;
|
||||
LDAPMessage *
|
||||
find( char *who, int quiet )
|
||||
{
|
||||
register int i, j, k; /* general ints */
|
||||
int matches; /* from ldap_count_entries() */
|
||||
|
|
@ -177,9 +167,6 @@ int quiet;
|
|||
char response[SMALL_BUF_SIZE];
|
||||
char *cp, *dn, **rdns;
|
||||
LDAPFiltInfo *fi;
|
||||
extern LDAPFiltDesc *lfdp; /* LDAP filter descriptor */
|
||||
extern struct attribute attrlist[]; /* complete list of attrs */
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -342,8 +329,8 @@ int quiet;
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
pick_one(i)
|
||||
int i;
|
||||
int
|
||||
pick_one( int i )
|
||||
{
|
||||
int n;
|
||||
char user_pick[SMALL_BUF_SIZE];
|
||||
|
|
@ -368,13 +355,10 @@ int i;
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
print_list(list, names, matches)
|
||||
LDAPMessage *list;
|
||||
char *names[];
|
||||
int *matches;
|
||||
void
|
||||
print_list( LDAPMessage *list, char **names, int *matches )
|
||||
{
|
||||
char **rdns, **cpp;
|
||||
extern int lpp;
|
||||
char resp[SMALL_BUF_SIZE];
|
||||
register LDAPMessage *ep;
|
||||
register int i = 1;
|
||||
|
|
@ -418,9 +402,8 @@ again:
|
|||
return;
|
||||
}
|
||||
|
||||
find_all_subscribers(sub, group)
|
||||
char *sub[];
|
||||
char *group;
|
||||
int
|
||||
find_all_subscribers( char **sub, char *group )
|
||||
{
|
||||
int count;
|
||||
LDAPMessage *result;
|
||||
|
|
@ -465,9 +448,8 @@ char *group;
|
|||
return(count);
|
||||
}
|
||||
|
||||
char * fetch_boolean_value(who, attr)
|
||||
char *who;
|
||||
struct attribute attr;
|
||||
char *
|
||||
fetch_boolean_value( char *who, struct attribute attr )
|
||||
{
|
||||
LDAPMessage *result; /* from the search below */
|
||||
register LDAPMessage *ep; /* entry pointer */
|
||||
|
|
|
|||
|
|
@ -13,15 +13,11 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/time.h> /* portable.h+ldap.h needs time_t */
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
#include "ud.h"
|
||||
|
||||
extern void set_boolean(),
|
||||
change_field(),
|
||||
#ifdef UOFM
|
||||
set_updates(),
|
||||
#endif
|
||||
mod_addrDN();
|
||||
|
||||
struct attribute attrlist[] = {
|
||||
|
||||
/*
|
||||
|
|
@ -30,8 +26,8 @@ struct attribute attrlist[] = {
|
|||
* Field 3 = function used to modify this field (if any)
|
||||
* Field 4 = Flags specifying how this field is displayed
|
||||
*/
|
||||
{ "memberOfGroup", "Subscriptions", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DN },
|
||||
{ "acl", "Access Control", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "memberOfGroup", "Subscriptions", 0, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DN },
|
||||
{ "acl", "Access Control", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "cn", "Aliases", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_SEARCH | ATTR_FLAG_GROUP_MOD },
|
||||
{ "title", "Title", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_SEARCH | ATTR_FLAG_PERSON_MOD },
|
||||
{ "postalAddress", "Business address", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD | ATTR_FLAG_IS_MULTILINE },
|
||||
|
|
@ -40,18 +36,18 @@ struct attribute attrlist[] = {
|
|||
{ "member", "Members", mod_addrDN, ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DN | ATTR_FLAG_GROUP_MOD },
|
||||
{ "homePhone", "Home phone", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
|
||||
{ "homePostalAddress", "Home address", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_IS_MULTILINE },
|
||||
{ "objectClass", "Object class", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_SEARCH },
|
||||
{ "objectClass", "Object class", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_SEARCH },
|
||||
#ifdef UOFM
|
||||
{ "multiLineDescription", "Description", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD | ATTR_FLAG_IS_MULTILINE },
|
||||
#endif
|
||||
#ifdef HAVE_KERBEROS
|
||||
{ "krbName", "Kerberos name", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_READ },
|
||||
{ "krbName", "Kerberos name", 0, ATTR_FLAG_PERSON | ATTR_FLAG_READ },
|
||||
#endif
|
||||
{ "description", "Brief description", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "description", "Brief description", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "facsimileTelephoneNumber", "Fax number", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD },
|
||||
{ "pager", "Pager number", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
|
||||
{ "uid", "Uniqname", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "userPassword", "Password", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "uid", "Uniqname", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
{ "userPassword", "Password", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
|
||||
#ifdef UOFM
|
||||
{ "noBatchUpdates", "No batch updates", set_updates, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
|
||||
#endif
|
||||
|
|
@ -67,7 +63,7 @@ struct attribute attrlist[] = {
|
|||
{ "onVacation", "On Vacation", set_boolean, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_IS_A_BOOL },
|
||||
{ "vacationMessage", "Vacation Message", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_IS_MULTILINE },
|
||||
{ "drink", "Favorite Beverage", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
|
||||
{ "lastModifiedBy", "Last modified by", NULL, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_IS_A_DN | ATTR_FLAG_READ },
|
||||
{ "lastModifiedTime", "Last modified at", NULL, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DATE },
|
||||
{ NULL, NULL, NULL, ATTR_FLAG_NONE }
|
||||
{ "lastModifiedBy", "Last modified by", 0, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_IS_A_DN | ATTR_FLAG_READ },
|
||||
{ "lastModifiedTime", "Last modified at", 0, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DATE },
|
||||
{ NULL, NULL, 0, ATTR_FLAG_NONE }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,31 +16,21 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
||||
#include <ldapconfig.h>
|
||||
#include "ud.h"
|
||||
|
||||
extern LDAPMessage * find();
|
||||
static char * bind_and_fetch(char *name);
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
#endif
|
||||
|
||||
extern char *bound_dn, *group_base;
|
||||
extern int verbose, bind_status;
|
||||
extern struct entry Entry;
|
||||
extern LDAP *ld;
|
||||
|
||||
extern void Free();
|
||||
|
||||
static char * bind_and_fetch();
|
||||
|
||||
void add_group(name)
|
||||
char *name;
|
||||
void
|
||||
add_group( char *name )
|
||||
{
|
||||
register int i, idx = 0, prompt = 0;
|
||||
char tmp[BUFSIZ], dn[BUFSIZ];
|
||||
|
|
@ -50,8 +40,6 @@ char *name;
|
|||
char *init_rdn_value[2], *init_owner_value[2], *init_domain_value[2],
|
||||
*init_errors_value[MAX_VALUES], *init_joinable_value[2],
|
||||
*init_request_value[MAX_VALUES];
|
||||
extern void ldap_flush_cache();
|
||||
extern char * strip_ignore_chars();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE) {
|
||||
|
|
@ -168,7 +156,6 @@ char *name;
|
|||
register LDAPMod **lpp;
|
||||
register char **cpp;
|
||||
register int j;
|
||||
extern char * code_to_str();
|
||||
printf(" About to call ldap_add()\n");
|
||||
printf(" ld = 0x%x\n", ld);
|
||||
printf(" dn = [%s]\n", dn);
|
||||
|
|
@ -207,8 +194,8 @@ char *name;
|
|||
return;
|
||||
}
|
||||
|
||||
void remove_group(name)
|
||||
char *name;
|
||||
void
|
||||
remove_group( char *name )
|
||||
{
|
||||
char *dn, tmp[BUFSIZ];
|
||||
|
||||
|
|
@ -255,9 +242,8 @@ char *name;
|
|||
return;
|
||||
}
|
||||
|
||||
void x_group(action, name)
|
||||
int action;
|
||||
char *name;
|
||||
void
|
||||
x_group( int action, char *name )
|
||||
{
|
||||
char **vp;
|
||||
char *values[2], *group_name;
|
||||
|
|
@ -354,8 +340,8 @@ char *name;
|
|||
return;
|
||||
}
|
||||
|
||||
void bulk_load(group)
|
||||
char *group;
|
||||
void
|
||||
bulk_load( char *group )
|
||||
{
|
||||
register int idx_mail, idx_x500;
|
||||
register int count_mail, count_x500;
|
||||
|
|
@ -510,15 +496,13 @@ char *group;
|
|||
return;
|
||||
}
|
||||
|
||||
void purge_group(group)
|
||||
char *group;
|
||||
void
|
||||
purge_group( char *group )
|
||||
{
|
||||
int isclean = TRUE;
|
||||
LDAPMessage *lm;
|
||||
LDAPMod mod, *mods[2];
|
||||
char dn[BUFSIZ], tmp[BUFSIZ], *values[2], **vp, **rdns;
|
||||
extern char * my_ldap_dn2ufn();
|
||||
extern int col_size;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE) {
|
||||
|
|
@ -664,7 +648,8 @@ ask:
|
|||
return;
|
||||
}
|
||||
|
||||
void tidy_up()
|
||||
void
|
||||
tidy_up( void )
|
||||
{
|
||||
register int i = 0;
|
||||
int found_one = 0;
|
||||
|
|
@ -739,11 +724,9 @@ void tidy_up()
|
|||
* Names or e-mail addresses. This includes things like group members,
|
||||
* the errors-to field in groups, and so on.
|
||||
*/
|
||||
void mod_addrDN(group, offset)
|
||||
char *group;
|
||||
int offset;
|
||||
void
|
||||
mod_addrDN( char *group, int offset )
|
||||
{
|
||||
extern struct attribute attrlist[];
|
||||
char s[BUFSIZ], *new_value /* was member */, *values[2];
|
||||
char attrtype[ 64 ];
|
||||
int i;
|
||||
|
|
@ -1012,10 +995,8 @@ int offset;
|
|||
}
|
||||
}
|
||||
|
||||
my_ldap_modify_s(ldap, group, mods)
|
||||
LDAP *ldap;
|
||||
char *group;
|
||||
LDAPMod *mods[];
|
||||
int
|
||||
my_ldap_modify_s( LDAP *ldap, char *group, LDAPMod **mods )
|
||||
{
|
||||
int was_rfc822member, rc;
|
||||
|
||||
|
|
@ -1034,8 +1015,8 @@ LDAPMod *mods[];
|
|||
return(rc);
|
||||
}
|
||||
|
||||
void list_groups(who)
|
||||
char *who;
|
||||
void
|
||||
list_groups( char *who )
|
||||
{
|
||||
LDAPMessage *mp;
|
||||
char name[BUFSIZ], filter[BUFSIZ], *search_attrs[2];
|
||||
|
|
@ -1113,12 +1094,11 @@ char *who;
|
|||
return;
|
||||
}
|
||||
|
||||
static char * bind_and_fetch(name)
|
||||
char *name;
|
||||
static char *
|
||||
bind_and_fetch( char *name )
|
||||
{
|
||||
LDAPMessage *lm;
|
||||
char tmp[MED_BUF_SIZE];
|
||||
extern char * strip_ignore_chars();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE) {
|
||||
|
|
@ -1168,8 +1148,8 @@ char *name;
|
|||
return(strdup(Entry.DN));
|
||||
}
|
||||
|
||||
void list_memberships(who)
|
||||
char *who;
|
||||
void
|
||||
list_memberships( char *who )
|
||||
{
|
||||
LDAPMessage *mp;
|
||||
char name[BUFSIZ], filter[BUFSIZ], *search_attrs[2];
|
||||
|
|
|
|||
|
|
@ -23,12 +23,9 @@
|
|||
|
||||
#include "ud.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
#endif
|
||||
|
||||
print_help(s)
|
||||
char *s;
|
||||
void
|
||||
print_help( char *s )
|
||||
{
|
||||
int len; /* command length */
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
extern char *strdup (const char *);
|
||||
extern char *getenv(const char *);
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
|
|
@ -28,6 +30,7 @@
|
|||
|
||||
#include <ac/signal.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/termios.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
|
|
@ -81,14 +84,10 @@ LDAPFiltDesc *lfdp; /* LDAP filter descriptor */
|
|||
int debug; /* debug flag */
|
||||
#endif
|
||||
|
||||
extern void initialize_client();
|
||||
extern void initialize_attribute_strings();
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
extern char Version[]; /* version number */
|
||||
extern char *optarg; /* for parsing argv */
|
||||
register int c; /* for parsing argv */
|
||||
register char *cp; /* for parsing Version */
|
||||
|
|
@ -164,7 +163,8 @@ char *argv[];
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
do_commands()
|
||||
void
|
||||
do_commands( void )
|
||||
{
|
||||
LDAPMessage *mp; /* returned by find() */
|
||||
register char *cp; /* misc char pointer */
|
||||
|
|
@ -172,10 +172,6 @@ do_commands()
|
|||
static char buf[MED_BUF_SIZE]; /* for prompting */
|
||||
static char cmd[MED_BUF_SIZE]; /* holds the command */
|
||||
static char input[MED_BUF_SIZE]; /* buffer for input */
|
||||
extern LDAPMessage *find();
|
||||
extern void purge_group(), add_group(), remove_group(), x_group(),
|
||||
tidy_up(), list_groups(), list_memberships(), edit();
|
||||
extern char *nextstr();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -286,9 +282,9 @@ do_commands()
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
status()
|
||||
void
|
||||
status( void )
|
||||
{
|
||||
void printbase();
|
||||
register char **rdns;
|
||||
char *host;
|
||||
|
||||
|
|
@ -325,9 +321,8 @@ status()
|
|||
}
|
||||
}
|
||||
|
||||
change_base(type, base, s)
|
||||
int type;
|
||||
char **base, *s;
|
||||
void
|
||||
change_base( int type, char **base, char *s )
|
||||
{
|
||||
register char *cp; /* utility pointers */
|
||||
char **rdns; /* for parsing */
|
||||
|
|
@ -341,13 +336,9 @@ char **base, *s;
|
|||
static char *choices[MED_BUF_SIZE]; /* bases from which to choose */
|
||||
static char resp[SMALL_BUF_SIZE]; /* for prompting user */
|
||||
static char buf[MED_BUF_SIZE];
|
||||
void printbase();
|
||||
static char *attrs[] = { "objectClass", NULL };
|
||||
LDAPMessage *mp; /* results from a search */
|
||||
LDAPMessage *ep; /* for going thru bases */
|
||||
extern char * friendly_name();
|
||||
extern void StrFreeDup();
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -544,7 +535,8 @@ char **base, *s;
|
|||
}
|
||||
}
|
||||
|
||||
void initialize_client()
|
||||
void
|
||||
initialize_client( void )
|
||||
{
|
||||
FILE *fp; /* for config file */
|
||||
static char buffer[MED_BUF_SIZE]; /* for input */
|
||||
|
|
@ -553,9 +545,6 @@ void initialize_client()
|
|||
char *term; /* for tty set-up */
|
||||
char *config; /* config file to use */
|
||||
static char bp[1024]; /* for tty set-up */
|
||||
extern RETSIGTYPE attn(); /* ^C signal handler */
|
||||
extern char *getenv();
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -693,7 +682,6 @@ void initialize_client()
|
|||
#ifndef NO_TERMCAP
|
||||
{
|
||||
struct winsize win; /* for tty set-up */
|
||||
extern RETSIGTYPE chwinsz(); /* WINSZ signal handler */
|
||||
|
||||
if (((term = getenv("TERM")) == NULL) || (tgetent(bp, term) <= 0))
|
||||
return;
|
||||
|
|
@ -721,7 +709,8 @@ void initialize_client()
|
|||
#endif
|
||||
}
|
||||
|
||||
RETSIGTYPE attn()
|
||||
RETSIGTYPE
|
||||
attn( int sig )
|
||||
{
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
|
|
@ -732,8 +721,9 @@ RETSIGTYPE attn()
|
|||
longjmp(env, 1);
|
||||
}
|
||||
|
||||
#ifndef NO_TERMCAP
|
||||
RETSIGTYPE chwinsz()
|
||||
#if !defined(NO_TERMCAP) && defined(TIOCGWINSZ)
|
||||
RETSIGTYPE
|
||||
chwinsz( int sig )
|
||||
{
|
||||
struct winsize win;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
|
|
@ -21,28 +22,14 @@
|
|||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
#include "ud.h"
|
||||
extern void Free();
|
||||
|
||||
extern struct entry Entry;
|
||||
extern int verbose;
|
||||
extern LDAP *ld;
|
||||
static char *get_URL( void );
|
||||
static int check_URL( char *url );
|
||||
|
||||
extern LDAPMessage *find();
|
||||
extern void * Malloc();
|
||||
|
||||
static char * get_URL();
|
||||
static int check_URL();
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
#endif
|
||||
|
||||
modify(who)
|
||||
char *who;
|
||||
void
|
||||
modify( char *who )
|
||||
{
|
||||
#ifdef UOFM
|
||||
void set_updates(); /* routine to modify noBatchUpdates */
|
||||
#endif
|
||||
LDAPMessage *mp; /* returned from find() */
|
||||
char *dn; /* distinguished name */
|
||||
char **rdns; /* for fiddling with the DN */
|
||||
|
|
@ -52,12 +39,9 @@ char *who;
|
|||
#ifdef UOFM
|
||||
static char printed_warning = 0; /* for use with the */
|
||||
struct attribute no_batch_update_attr;
|
||||
extern char * fetch_boolean_value();
|
||||
int ld_errno;
|
||||
#endif
|
||||
int is_a_group; /* TRUE if it is; FALSE otherwise */
|
||||
extern void Free();
|
||||
extern int bind_status;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -169,14 +153,16 @@ char *who;
|
|||
}
|
||||
|
||||
/* generic routine for changing any field */
|
||||
void change_field(who, attr)
|
||||
char *who; /* DN of entry we are changing */
|
||||
struct attribute attr; /* attribute to change */
|
||||
void
|
||||
change_field(
|
||||
char *who, /* DN of entry we are changing */
|
||||
int attr_idx /* attribute to change */
|
||||
)
|
||||
{
|
||||
struct attribute attr = Entry.attrs[attr_to_index(attrlist[attr_idx].quipu_name)];
|
||||
|
||||
#define IS_MOD(x) (!strncasecmp(resp, (x), strlen(resp)))
|
||||
|
||||
char *get_value(); /* routine to extract values */
|
||||
static char buf[MED_BUF_SIZE]; /* for printing things */
|
||||
static char resp[SMALL_BUF_SIZE]; /* for user input */
|
||||
char *prompt, *prompt2, *more;
|
||||
|
|
@ -184,7 +170,6 @@ struct attribute attr; /* attribute to change */
|
|||
static LDAPMod mod;
|
||||
static LDAPMod *mods[2] = { &mod }; /* passed to ldap_modify */
|
||||
static char *values[MAX_VALUES]; /* passed to ldap_modify */
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -382,8 +367,8 @@ struct attribute attr; /* attribute to change */
|
|||
#define MAX_DESC_LINES 24
|
||||
#define INTL_ADDR_LIMIT 30
|
||||
|
||||
char *get_value(id, prompt)
|
||||
char *id, *prompt;
|
||||
char *
|
||||
get_value( char *id, char *prompt )
|
||||
{
|
||||
char *cp; /* for the Malloc() */
|
||||
int count; /* line # of new value -- if multiline */
|
||||
|
|
@ -545,12 +530,15 @@ mail_is_good:
|
|||
return(cp);
|
||||
}
|
||||
|
||||
void set_boolean(who, attr)
|
||||
char *who; /* DN of entry we are changing */
|
||||
struct attribute attr; /* boolean attribute to change */
|
||||
void
|
||||
set_boolean(
|
||||
char *who, /* DN of entry we are changing */
|
||||
int attr_idx /* boolean attribute to change */
|
||||
)
|
||||
{
|
||||
struct attribute attr = Entry.attrs[attr_to_index(attrlist[attr_idx].quipu_name)];
|
||||
|
||||
char *cp, *s;
|
||||
extern char * fetch_boolean_value();
|
||||
static char response[16];
|
||||
static char *newsetting[2] = { NULL, NULL };
|
||||
LDAPMod mod, *mods[2];
|
||||
|
|
@ -604,11 +592,10 @@ struct attribute attr; /* boolean attribute to change */
|
|||
|
||||
#ifdef UOFM
|
||||
|
||||
void set_updates(who)
|
||||
char *who;
|
||||
void
|
||||
set_updates( char *who, int dummy )
|
||||
{
|
||||
char *cp, *s;
|
||||
extern char * fetch_boolean_value();
|
||||
static char response[16];
|
||||
static char value[6];
|
||||
static char *newsetting[2] = { value, NULL };
|
||||
|
|
@ -674,11 +661,10 @@ char *who;
|
|||
|
||||
#endif
|
||||
|
||||
print_mod_list(group)
|
||||
int group;
|
||||
void
|
||||
print_mod_list( int group )
|
||||
{
|
||||
register int i, j = 1;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
if (group == TRUE) {
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++) {
|
||||
|
|
@ -703,15 +689,11 @@ int group;
|
|||
#endif
|
||||
}
|
||||
|
||||
perform_action(choice, dn, group)
|
||||
char choice[];
|
||||
char *dn;
|
||||
int group;
|
||||
int
|
||||
perform_action( char *choice, char *dn, int group )
|
||||
{
|
||||
int selection;
|
||||
register int i, j = 1;
|
||||
extern struct attribute attrlist[];
|
||||
extern void mod_addrDN(), change_field(), set_boolean();
|
||||
|
||||
selection = atoi(choice);
|
||||
if (selection < 1) {
|
||||
|
|
@ -747,18 +729,12 @@ int group;
|
|||
return(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (attrlist[i].mod_func == change_field)
|
||||
(*attrlist[i].mod_func)(dn, Entry.attrs[attr_to_index(attrlist[i].quipu_name)]);
|
||||
else if (attrlist[i].mod_func == mod_addrDN)
|
||||
(*attrlist[i].mod_func)(dn, i);
|
||||
else if (attrlist[i].mod_func == set_boolean)
|
||||
(*attrlist[i].mod_func)(dn, Entry.attrs[attr_to_index(attrlist[i].quipu_name)]);
|
||||
else
|
||||
(*attrlist[i].mod_func)(dn);
|
||||
(*attrlist[i].mod_func)(dn, i);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static char * get_URL()
|
||||
static char *
|
||||
get_URL( void )
|
||||
{
|
||||
char *rvalue, label[MED_BUF_SIZE], url[MED_BUF_SIZE];
|
||||
|
||||
|
|
@ -788,8 +764,8 @@ static char * get_URL()
|
|||
return((char *) rvalue);
|
||||
}
|
||||
|
||||
static check_URL(url)
|
||||
char *url;
|
||||
static int
|
||||
check_URL( char *url )
|
||||
{
|
||||
register char *cp;
|
||||
|
||||
|
|
@ -803,6 +779,7 @@ char *url;
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
mod_perror( LDAP *ld )
|
||||
{
|
||||
int ld_errno = 0;
|
||||
|
|
|
|||
|
|
@ -17,25 +17,17 @@
|
|||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
||||
#include "ud.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
#endif
|
||||
|
||||
struct entry Entry;
|
||||
extern LDAP *ld;
|
||||
|
||||
extern void * Malloc();
|
||||
extern void Free();
|
||||
extern char * my_ldap_dn2ufn();
|
||||
|
||||
static char *time2text();
|
||||
static long gtime();
|
||||
static char *time2text(char *ldtimestr, int dateonly);
|
||||
static long gtime(struct tm *tm);
|
||||
|
||||
/*
|
||||
* When displaying entries, display only these attributes, and in this
|
||||
|
|
@ -85,15 +77,15 @@ static char *group_attr_print_order[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
parse_answer(s)
|
||||
LDAPMessage *s;
|
||||
|
||||
void
|
||||
parse_answer( LDAPMessage *s )
|
||||
{
|
||||
int idx;
|
||||
char **rdns;
|
||||
BerElement *cookie;
|
||||
register LDAPMessage *ep;
|
||||
register char *ap;
|
||||
void clear_entry();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -142,10 +134,8 @@ LDAPMessage *s;
|
|||
#endif
|
||||
}
|
||||
|
||||
add_value(attr, ep, ap)
|
||||
struct attribute *attr;
|
||||
LDAPMessage *ep;
|
||||
char *ap;
|
||||
void
|
||||
add_value( struct attribute *attr, LDAPMessage *ep, char *ap )
|
||||
{
|
||||
register int i = 0;
|
||||
char **vp, **tp, **avp;
|
||||
|
|
@ -190,12 +180,12 @@ char *ap;
|
|||
ldap_value_free(vp);
|
||||
}
|
||||
|
||||
print_an_entry()
|
||||
void
|
||||
print_an_entry( void )
|
||||
{
|
||||
int n = 0, i, idx;
|
||||
char is_a_group, **order;
|
||||
char *sub_list[MAX_VALUES], buf[SMALL_BUF_SIZE];
|
||||
extern int col_size, isaurl(), isadn();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -281,8 +271,8 @@ print_an_entry()
|
|||
#define OUT_LABEL_LEN 20
|
||||
|
||||
/* prints the values associated with an attribute */
|
||||
print_values(A)
|
||||
struct attribute A;
|
||||
void
|
||||
print_values( struct attribute A )
|
||||
{
|
||||
register int i, k;
|
||||
register char *cp, **vp;
|
||||
|
|
@ -374,13 +364,12 @@ struct attribute A;
|
|||
}
|
||||
|
||||
/* prints the DN's associated with an attribute */
|
||||
print_DN(A)
|
||||
struct attribute A;
|
||||
void
|
||||
print_DN( struct attribute A )
|
||||
{
|
||||
int i, lead;
|
||||
register char **vp;
|
||||
char out_buf[MED_BUF_SIZE], *padding = NULL;
|
||||
extern int col_size;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -411,10 +400,10 @@ struct attribute A;
|
|||
return;
|
||||
}
|
||||
|
||||
void clear_entry()
|
||||
void
|
||||
clear_entry( void )
|
||||
{
|
||||
register int i;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -460,11 +449,10 @@ void clear_entry()
|
|||
}
|
||||
}
|
||||
|
||||
attr_to_index(s)
|
||||
char *s;
|
||||
int
|
||||
attr_to_index( char *s )
|
||||
{
|
||||
register int i;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++)
|
||||
if (!strcasecmp(s, attrlist[i].quipu_name))
|
||||
|
|
@ -472,11 +460,10 @@ char *s;
|
|||
return(-1);
|
||||
}
|
||||
|
||||
void initialize_attribute_strings()
|
||||
void
|
||||
initialize_attribute_strings( void )
|
||||
{
|
||||
register int i;
|
||||
extern struct entry Entry;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++)
|
||||
Entry.attrs[i].quipu_name = attrlist[i].quipu_name;
|
||||
|
|
@ -485,8 +472,8 @@ void initialize_attribute_strings()
|
|||
}
|
||||
|
||||
/* prints the URL/label pairs associated with an attribute */
|
||||
print_URL(A)
|
||||
struct attribute A;
|
||||
void
|
||||
print_URL( struct attribute A )
|
||||
{
|
||||
int i, lead;
|
||||
register char **vp;
|
||||
|
|
@ -520,16 +507,11 @@ struct attribute A;
|
|||
return;
|
||||
}
|
||||
|
||||
print_one_URL(s, label_lead, tag, url_lead)
|
||||
char *s;
|
||||
int label_lead;
|
||||
char *tag;
|
||||
int url_lead;
|
||||
void
|
||||
print_one_URL( char *s, int label_lead, char *tag, int url_lead )
|
||||
{
|
||||
register int i;
|
||||
char c, *cp, *url;
|
||||
extern int col_size;
|
||||
extern void Free();
|
||||
|
||||
for (cp = s; !isspace(*cp) && (*cp != '\0'); cp++)
|
||||
;
|
||||
|
|
@ -615,7 +597,8 @@ int dmsize[] = {
|
|||
|
||||
/* */
|
||||
|
||||
static long gtime ( struct tm *tm )
|
||||
static long
|
||||
gtime( struct tm *tm )
|
||||
{
|
||||
register int i,
|
||||
sec,
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ extern void des_fixup_key_parity();
|
|||
* convert an arbitrary length string to a DES key
|
||||
*/
|
||||
int
|
||||
des_string_to_key(str,key)
|
||||
char *str;
|
||||
register des_cblock *key;
|
||||
des_string_to_key( char *str, register des_cblock *key )
|
||||
{
|
||||
register char *in_str;
|
||||
register unsigned temp,i;
|
||||
|
|
@ -145,10 +143,12 @@ des_string_to_key(str,key)
|
|||
encryption key. It is compatible with the original Andrew authentication
|
||||
service password database. */
|
||||
|
||||
static void Andrew_StringToKey (str, cell, key)
|
||||
char *str;
|
||||
char *cell; /* cell for password */
|
||||
des_cblock *key;
|
||||
static void
|
||||
Andrew_StringToKey(
|
||||
char *str,
|
||||
char *cell, /* cell for password */
|
||||
des_cblock *key
|
||||
)
|
||||
{ char password[8+1]; /* crypt is limited to 8 chars anyway */
|
||||
int i;
|
||||
int passlen;
|
||||
|
|
@ -184,10 +184,12 @@ static void Andrew_StringToKey (str, cell, key)
|
|||
des_fixup_key_parity (key);
|
||||
}
|
||||
|
||||
static void StringToKey (str, cell, key)
|
||||
char *str;
|
||||
char *cell; /* cell for password */
|
||||
des_cblock *key;
|
||||
static void
|
||||
StringToKey(
|
||||
char *str,
|
||||
char *cell, /* cell for password */
|
||||
des_cblock *key
|
||||
)
|
||||
{ des_key_schedule schedule;
|
||||
char temp_key[8];
|
||||
char ivec[8];
|
||||
|
|
@ -213,16 +215,19 @@ static void StringToKey (str, cell, key)
|
|||
des_fixup_key_parity (key);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ka_StringToKey (str, cell, key)
|
||||
char *str;
|
||||
char *cell; /* cell for password */
|
||||
des_cblock *key;
|
||||
void
|
||||
ka_StringToKey (
|
||||
char *str,
|
||||
char *cell, /* cell for password */
|
||||
des_cblock *key
|
||||
)
|
||||
{ char realm[REALM_SZ];
|
||||
|
||||
#if NOWAYOUTTODAY
|
||||
long code;
|
||||
/* code = ka_CellToRealm (cell, realm, 0/*local*/); */
|
||||
#if 0
|
||||
code = ka_CellToRealm (cell, realm, 0/*local*/);
|
||||
#endif
|
||||
if (code) strcpy (realm, "");
|
||||
else lcstring (realm, realm, sizeof(realm)); /* for backward compatibility */
|
||||
#else
|
||||
|
|
@ -237,9 +242,7 @@ ka_StringToKey (str, cell, key)
|
|||
* convert an arbitrary length string to a DES key
|
||||
*/
|
||||
int
|
||||
des_string_to_key(str,key)
|
||||
char *str;
|
||||
register des_cblock *key;
|
||||
des_string_to_key( char *str, register des_cblock *key )
|
||||
{
|
||||
/* NB: i should probably call routine to get local cell here */
|
||||
ka_StringToKey(str, "umich.edu", key);
|
||||
|
|
|
|||
143
clients/ud/ud.h
143
clients/ud/ud.h
|
|
@ -138,7 +138,7 @@ LDAP_BEGIN_DECL
|
|||
struct attribute {
|
||||
char *quipu_name;
|
||||
char *output_string;
|
||||
void (*mod_func)();
|
||||
void (*mod_func) LDAP_P(( char *who, int attr_idx ));
|
||||
unsigned short flags;
|
||||
int number_of_values;
|
||||
char **values;
|
||||
|
|
@ -152,4 +152,145 @@ struct entry {
|
|||
struct attribute attrs[MAX_ATTRS];
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Variables
|
||||
*/
|
||||
|
||||
/* in globals.c: */
|
||||
extern struct attribute attrlist[];/* complete list of attrs */
|
||||
/* in main.c: */
|
||||
extern char copyright[];
|
||||
extern char *default_bind_object;
|
||||
extern char *bound_dn;
|
||||
extern char *group_base;
|
||||
extern char *search_base; /* search base */
|
||||
extern int lpp;
|
||||
extern int verbose; /* verbose mode flag */
|
||||
extern int col_size;
|
||||
extern int bind_status;
|
||||
extern LDAP *ld; /* our ldap descriptor */
|
||||
extern LDAPFiltDesc *lfdp; /* LDAP filter descriptor */
|
||||
#ifdef DEBUG
|
||||
extern int debug; /* debug flag */
|
||||
#endif
|
||||
/* in print.c: */
|
||||
extern struct entry Entry;
|
||||
extern int dmsize[];
|
||||
/* in version.c: */
|
||||
extern char Version[];
|
||||
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
|
||||
/* in auth.c: */
|
||||
int auth LDAP_P(( char *who, int implicit ));
|
||||
#if defined(HAVE_KERBEROS) && defined(_AC_KRB_H)
|
||||
int krbgetpass LDAP_P(( char *u, char *in, char *re, char *pw, C_Block key ));
|
||||
void destroy_tickets LDAP_P(( void ));
|
||||
#endif
|
||||
|
||||
/* in edit.c: */
|
||||
void edit LDAP_P(( char *who ));
|
||||
|
||||
/* in find.c: */
|
||||
int vrfy LDAP_P(( char *dn ));
|
||||
LDAPMessage *find LDAP_P(( char *who, int quiet ));
|
||||
int pick_one LDAP_P(( int i ));
|
||||
void print_list LDAP_P(( LDAPMessage *list, char **names, int *matches ));
|
||||
int find_all_subscribers LDAP_P(( char **sub, char *group ));
|
||||
char *fetch_boolean_value LDAP_P(( char *who, struct attribute attr ));
|
||||
|
||||
/* in globals.c: */
|
||||
|
||||
/* in group.c: */
|
||||
void add_group LDAP_P(( char *name ));
|
||||
void remove_group LDAP_P(( char *name ));
|
||||
void x_group LDAP_P(( int action, char *name ));
|
||||
void bulk_load LDAP_P(( char *group ));
|
||||
void purge_group LDAP_P(( char *group ));
|
||||
void tidy_up LDAP_P(( void ));
|
||||
void mod_addrDN LDAP_P(( char *group, int offset ));
|
||||
int my_ldap_modify_s LDAP_P(( LDAP *ldap, char *group, LDAPMod **mods ));
|
||||
void list_groups LDAP_P(( char *who ));
|
||||
void list_memberships LDAP_P(( char *who ));
|
||||
|
||||
/* in help.c: */
|
||||
void print_help LDAP_P(( char *s ));
|
||||
|
||||
/* in main.c: */
|
||||
#ifdef DEBUG
|
||||
#endif
|
||||
|
||||
void do_commands LDAP_P(( void ));
|
||||
void status LDAP_P(( void ));
|
||||
void change_base LDAP_P(( int type, char **base, char *s ));
|
||||
void initialize_client LDAP_P(( void ));
|
||||
RETSIGTYPE attn LDAP_P(( int sig ));
|
||||
#ifndef NO_TERMCAP
|
||||
RETSIGTYPE chwinsz LDAP_P(( int sig ));
|
||||
#endif
|
||||
|
||||
/* in mod.c: */
|
||||
void modify LDAP_P(( char *who ));
|
||||
void change_field LDAP_P(( char *who, int attr_idx ));
|
||||
char *get_value LDAP_P(( char *id, char *prompt ));
|
||||
void set_boolean LDAP_P(( char *who, int attr_idx ));
|
||||
#ifdef UOFM
|
||||
void set_updates LDAP_P(( char *who, int dummy ));
|
||||
#endif
|
||||
void print_mod_list LDAP_P(( int group ));
|
||||
int perform_action LDAP_P(( char *choice, char *dn, int group ));
|
||||
void mod_perror LDAP_P(( LDAP *ld ));
|
||||
|
||||
/* in print.c: */
|
||||
void parse_answer LDAP_P(( LDAPMessage *s ));
|
||||
void add_value LDAP_P(( struct attribute *attr, LDAPMessage *ep, char *ap ));
|
||||
void print_an_entry LDAP_P(( void ));
|
||||
void print_values LDAP_P(( struct attribute A ));
|
||||
void print_DN LDAP_P(( struct attribute A ));
|
||||
void clear_entry LDAP_P(( void ));
|
||||
int attr_to_index LDAP_P(( char *s ));
|
||||
void initialize_attribute_strings LDAP_P(( void ));
|
||||
void print_URL LDAP_P(( struct attribute A ));
|
||||
void print_one_URL LDAP_P(( char *s, int l_lead, char *tag, int u_lead ));
|
||||
|
||||
/* in string_to_key.c: */
|
||||
#if defined(HAVE_KERBEROS) && !defined(openbsd) && defined(_AC_KRB_H)
|
||||
#if defined(HAVE_AFS_KERBEROS) || !defined(HAVE_KERBEROS_V)
|
||||
int des_string_to_key LDAP_P(( char *str, des_cblock *key ));
|
||||
#endif
|
||||
#if defined(HAVE_AFS_KERBEROS)
|
||||
void ka_StringToKey LDAP_P(( char *str, char *cell, des_cblock *key ));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* in util.c: */
|
||||
char *mygetpass LDAP_P(( char *prompt ));
|
||||
void printbase LDAP_P(( char *lead, char *s ));
|
||||
void fetch_buffer LDAP_P(( char *buffer, int length, FILE *where ));
|
||||
void fatal LDAP_P(( char *s ));
|
||||
int isgroup LDAP_P(( void ));
|
||||
void format LDAP_P(( char *str, int width, int lead ));
|
||||
void format2 LDAP_P(( char *s, char *ft, char *t, int fi, int i, int w ));
|
||||
char *strip_ignore_chars LDAP_P(( char *cp ));
|
||||
char *code_to_str LDAP_P(( int i ));
|
||||
char *friendly_name LDAP_P(( char *s ));
|
||||
#ifdef UOFM
|
||||
int isauniqname LDAP_P(( char *s ));
|
||||
#endif
|
||||
int isadn LDAP_P(( char *s ));
|
||||
char *my_ldap_dn2ufn LDAP_P(( char *s ));
|
||||
int isaurl LDAP_P(( char *s ));
|
||||
int isadate LDAP_P(( char *s ));
|
||||
void *Malloc LDAP_P(( unsigned int size ));
|
||||
void Free LDAP_P(( void *ptr ));
|
||||
char *nextstr LDAP_P(( char *s ));
|
||||
void free_mod_struct LDAP_P(( LDAPMod *modp ));
|
||||
void StrFreeDup LDAP_P(( char **ptr, char *new_value ));
|
||||
int confirm_action LDAP_P(( char *msg ));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
|
|
|||
|
|
@ -29,12 +29,8 @@
|
|||
|
||||
#include "ud.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
#endif
|
||||
|
||||
char * mygetpass(prompt)
|
||||
char *prompt;
|
||||
char *
|
||||
mygetpass( char *prompt )
|
||||
{
|
||||
#if !defined(HAVE_TERMIOS) && !defined(HAVE_SGTTY_H)
|
||||
static char buf[256];
|
||||
|
|
@ -61,7 +57,7 @@ char *prompt;
|
|||
register char *p;
|
||||
register int c;
|
||||
FILE *fi;
|
||||
RETSIGTYPE (*sig)();
|
||||
RETSIGTYPE (*sig)( int sig );
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -145,12 +141,11 @@ char *prompt;
|
|||
#endif /* DOS */
|
||||
}
|
||||
|
||||
void printbase(lead, s)
|
||||
char *lead, *s;
|
||||
void
|
||||
printbase( char *lead, char *s )
|
||||
{
|
||||
register char **cp;
|
||||
char **rdns;
|
||||
char * friendly_name();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -176,12 +171,9 @@ char *lead, *s;
|
|||
return;
|
||||
}
|
||||
|
||||
fetch_buffer(buffer, length, where)
|
||||
char *buffer;
|
||||
int length;
|
||||
FILE *where;
|
||||
void
|
||||
fetch_buffer( char *buffer, int length, FILE *where )
|
||||
{
|
||||
extern LDAP *ld;
|
||||
register int i;
|
||||
char *p;
|
||||
|
||||
|
|
@ -212,8 +204,8 @@ FILE *where;
|
|||
|
||||
}
|
||||
|
||||
fatal(s)
|
||||
char *s;
|
||||
void
|
||||
fatal( char *s )
|
||||
{
|
||||
if (errno != 0)
|
||||
perror(s);
|
||||
|
|
@ -223,9 +215,9 @@ char *s;
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
isgroup()
|
||||
int
|
||||
isgroup( void )
|
||||
{
|
||||
extern struct entry Entry;
|
||||
char **vp;
|
||||
register int i;
|
||||
int group = FALSE;
|
||||
|
|
@ -253,14 +245,11 @@ isgroup()
|
|||
* Print out the string 's' on a field of 'width' chracters. Each line
|
||||
* should be indented 'lead' characters.
|
||||
*/
|
||||
format(str, width, lead)
|
||||
char *str;
|
||||
int width, lead;
|
||||
void
|
||||
format( char *str, int width, int lead )
|
||||
{
|
||||
char *s, *original, *leader = "";
|
||||
register char *cp;
|
||||
void * Malloc();
|
||||
void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -309,14 +298,18 @@ int width, lead;
|
|||
* indented 'indent' spaces, then followed by 'tag', and then followed by
|
||||
* subsequent lines of 's'.
|
||||
*/
|
||||
format2(s, first_tag, tag, first_indent, indent, width)
|
||||
char *s, *first_tag, *tag;
|
||||
int first_indent, indent, width;
|
||||
void
|
||||
format2(
|
||||
char *s,
|
||||
char *first_tag,
|
||||
char *tag,
|
||||
int first_indent,
|
||||
int indent,
|
||||
int width
|
||||
)
|
||||
{
|
||||
char c, *fi, *i;
|
||||
register char *cp;
|
||||
void * Malloc();
|
||||
void Free();
|
||||
|
||||
if (first_tag == NULL)
|
||||
first_tag = "";
|
||||
|
|
@ -411,15 +404,13 @@ int first_indent, indent, width;
|
|||
#define IN_A_QUOTE 0
|
||||
#define OUT_OF_QUOTE 1
|
||||
|
||||
char * strip_ignore_chars(cp)
|
||||
char *cp;
|
||||
char *
|
||||
strip_ignore_chars( char *cp )
|
||||
{
|
||||
int had_a_comma = FALSE;
|
||||
int flag = OUT_OF_QUOTE;
|
||||
register char *rcp, *cp1;
|
||||
char *tmp;
|
||||
void * Malloc();
|
||||
void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
|
|
@ -464,7 +455,8 @@ char *cp;
|
|||
return(tmp);
|
||||
}
|
||||
|
||||
char * code_to_str(int i)
|
||||
char *
|
||||
code_to_str( int i )
|
||||
{
|
||||
switch(i) {
|
||||
case LDAP_MOD_ADD : return("ADD");
|
||||
|
|
@ -474,8 +466,8 @@ char * code_to_str(int i)
|
|||
}
|
||||
}
|
||||
|
||||
char * friendly_name(s)
|
||||
char *s;
|
||||
char *
|
||||
friendly_name( char *s )
|
||||
{
|
||||
static FriendlyMap *map = NULL;
|
||||
static char *cp;
|
||||
|
|
@ -489,8 +481,8 @@ char *s;
|
|||
#ifdef UOFM
|
||||
|
||||
/* return TRUE if s has the syntax of a uniqname */
|
||||
isauniqname(s)
|
||||
char *s;
|
||||
int
|
||||
isauniqname( char *s )
|
||||
{
|
||||
int i = strlen(s);
|
||||
|
||||
|
|
@ -506,11 +498,10 @@ char *s;
|
|||
#endif
|
||||
|
||||
/* return TRUE if this attribute should be printed as a DN */
|
||||
isadn(s)
|
||||
char *s;
|
||||
int
|
||||
isadn( char *s )
|
||||
{
|
||||
register int i;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++)
|
||||
if (!strcasecmp(s, attrlist[i].quipu_name))
|
||||
|
|
@ -520,8 +511,8 @@ char *s;
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
char * my_ldap_dn2ufn(s)
|
||||
char *s;
|
||||
char *
|
||||
my_ldap_dn2ufn( char *s )
|
||||
{
|
||||
register char **cpp;
|
||||
static char short_DN[BUFSIZ];
|
||||
|
|
@ -535,11 +526,10 @@ char *s;
|
|||
}
|
||||
|
||||
/* return TRUE if this attribute should be printed as a URL */
|
||||
isaurl(s)
|
||||
char *s;
|
||||
int
|
||||
isaurl( char *s )
|
||||
{
|
||||
register int i;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++)
|
||||
if (!strcasecmp(s, attrlist[i].quipu_name))
|
||||
|
|
@ -550,11 +540,10 @@ char *s;
|
|||
}
|
||||
|
||||
/* return TRUE if this attribute should be printed as a date and time */
|
||||
isadate(s)
|
||||
char *s;
|
||||
int
|
||||
isadate( char *s )
|
||||
{
|
||||
register int i;
|
||||
extern struct attribute attrlist[];
|
||||
|
||||
for (i = 0; attrlist[i].quipu_name != NULL; i++)
|
||||
if (!strcasecmp(s, attrlist[i].quipu_name))
|
||||
|
|
@ -564,8 +553,8 @@ char *s;
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
void * Malloc(size)
|
||||
unsigned int size;
|
||||
void *
|
||||
Malloc( unsigned int size )
|
||||
{
|
||||
void *void_ptr;
|
||||
|
||||
|
|
@ -578,8 +567,8 @@ unsigned int size;
|
|||
return(void_ptr);
|
||||
}
|
||||
|
||||
void Free(ptr)
|
||||
char *ptr;
|
||||
void
|
||||
Free( void *ptr )
|
||||
{
|
||||
#ifndef STDC_HEADERS
|
||||
if (free(ptr) < 0) {
|
||||
|
|
@ -593,8 +582,8 @@ char *ptr;
|
|||
return;
|
||||
}
|
||||
|
||||
char * nextstr(s)
|
||||
char *s;
|
||||
char *
|
||||
nextstr( char *s )
|
||||
{
|
||||
while (isspace(*s) && (*s != '\0'))
|
||||
s++;
|
||||
|
|
@ -605,22 +594,18 @@ char *s;
|
|||
return(s);
|
||||
}
|
||||
|
||||
void free_mod_struct(modp)
|
||||
LDAPMod *modp;
|
||||
void
|
||||
free_mod_struct( LDAPMod *modp )
|
||||
{
|
||||
void Free();
|
||||
|
||||
if (modp->mod_values != NULL)
|
||||
(void) ldap_value_free(modp->mod_values);
|
||||
Free(modp->mod_type);
|
||||
Free(modp);
|
||||
}
|
||||
|
||||
void StrFreeDup(ptr, new_value)
|
||||
char **ptr, *new_value;
|
||||
void
|
||||
StrFreeDup( char **ptr, char *new_value )
|
||||
{
|
||||
void Free();
|
||||
|
||||
if (*ptr != NULL)
|
||||
Free(*ptr);
|
||||
if (new_value == NULL)
|
||||
|
|
@ -630,8 +615,8 @@ char **ptr, *new_value;
|
|||
}
|
||||
|
||||
|
||||
confirm_action( msg )
|
||||
char *msg;
|
||||
int
|
||||
confirm_action( char *msg )
|
||||
{
|
||||
char tmp[SMALL_BUF_SIZE];
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
*/
|
||||
|
||||
#include "whois++.h"
|
||||
|
||||
extern char *index(), *rindex();
|
||||
#include <stdlib.h>
|
||||
extern int getdtablesize (void);
|
||||
|
||||
#define isspecial(c) ( (c) == ',' || (c) == ';' || (c) == ':' || (c) == '=' )
|
||||
|
||||
|
|
@ -38,9 +38,8 @@ static char **component = NULL;
|
|||
static int numberOfComponents;
|
||||
static int components = 10;
|
||||
|
||||
static int getToken( token )
|
||||
char *token;
|
||||
|
||||
static int
|
||||
getToken( char *token )
|
||||
{
|
||||
static char *buffer = NULL;
|
||||
static int idx;
|
||||
|
|
@ -208,10 +207,14 @@ char *token;
|
|||
}
|
||||
}
|
||||
|
||||
static int term( token, value, attribute, specifier, soundex )
|
||||
int token;
|
||||
char *value, *attribute;
|
||||
int *specifier, *soundex;
|
||||
static int
|
||||
term(
|
||||
int token,
|
||||
char *value,
|
||||
char *attribute,
|
||||
int *specifier,
|
||||
int *soundex
|
||||
)
|
||||
{
|
||||
char buffer[BUFSIZ], temp[BUFSIZ];
|
||||
int iterations;
|
||||
|
|
@ -341,10 +344,14 @@ int *specifier, *soundex;
|
|||
return token;
|
||||
}
|
||||
|
||||
static int processTerm( specifier, soundex, buffer, attribute, value )
|
||||
int specifier, soundex;
|
||||
char *buffer, *attribute, *value;
|
||||
|
||||
static int
|
||||
processTerm(
|
||||
int specifier,
|
||||
int soundex,
|
||||
char *buffer,
|
||||
char *attribute,
|
||||
char *value
|
||||
)
|
||||
{
|
||||
char *s, *t;
|
||||
char query[BUFSIZ];
|
||||
|
|
@ -367,7 +374,7 @@ char *buffer, *attribute, *value;
|
|||
sprintf( query, "(%s%s%s)", attribute,
|
||||
(soundex)?"~=":"=", buffer );
|
||||
} else {
|
||||
if ( ( s = index( buffer, ',' ) ) != NULL ) {
|
||||
if ( ( s = strchr( buffer, ',' ) ) != NULL ) {
|
||||
*s++ = '\0';
|
||||
while ( *s && isspace( *s ) )
|
||||
s++;
|
||||
|
|
@ -375,7 +382,7 @@ char *buffer, *attribute, *value;
|
|||
(soundex)?"~=":"=", buffer );
|
||||
component[numberOfComponents++] = strdup( query );
|
||||
/* let's just make sure there is no title */
|
||||
if ( ( t = rindex( s, ',' ) ) != NULL ) {
|
||||
if ( ( t = strrchr( s, ',' ) ) != NULL ) {
|
||||
*t++ = '\0';
|
||||
while ( *t && isspace( *t ) )
|
||||
t++;
|
||||
|
|
@ -389,7 +396,7 @@ char *buffer, *attribute, *value;
|
|||
sprintf( query, "%s *", &buffer[6] );
|
||||
strcpy( buffer, query );
|
||||
}
|
||||
if ( ( s = index( buffer, '@' ) ) != NULL ) {
|
||||
if ( ( s = strchr( buffer, '@' ) ) != NULL ) {
|
||||
*s++ = '\0';
|
||||
if ( *buffer == '\0' ) /* no username */
|
||||
sprintf( query, "(mail=*@%s)", s );
|
||||
|
|
@ -402,7 +409,7 @@ char *buffer, *attribute, *value;
|
|||
if ( soundex )
|
||||
printFormatted( lineLength, TRUE, stdout,
|
||||
"Fuzzy matching not supported on e-mail address queries" );
|
||||
} else if ( index( buffer, ' ' ) == NULL ) {
|
||||
} else if ( strchr( buffer, ' ' ) == NULL ) {
|
||||
sprintf( query,
|
||||
"(|(sn%s%s)(userid%s%s)(l%s%s)(ou%s%s)\
|
||||
(&(cn%s%s)(!(objectClass=person))))",
|
||||
|
|
@ -529,8 +536,8 @@ char *buffer, *attribute, *value;
|
|||
return SEARCH;
|
||||
}
|
||||
|
||||
int parseCommand( query )
|
||||
char *query;
|
||||
int
|
||||
parseCommand( char *query )
|
||||
{
|
||||
/*
|
||||
* This procedure reads the string sent by the user and breaks it
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
*/
|
||||
|
||||
#include "whois++.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static struct {
|
||||
char *str;
|
||||
|
|
@ -59,8 +60,8 @@ static struct {
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
static nextLine(fp)
|
||||
FILE *fp;
|
||||
static void
|
||||
nextLine( FILE *fp )
|
||||
{
|
||||
/*
|
||||
* We probably should check that the user hasn't put anything else
|
||||
|
|
@ -75,10 +76,8 @@ FILE *fp;
|
|||
/*
|
||||
* Get next word, skipping blanks & comments.
|
||||
*/
|
||||
static int getWord(buffer, size, fp)
|
||||
char *buffer;
|
||||
int size;
|
||||
FILE *fp;
|
||||
static int
|
||||
getWord( char *buffer, int size, FILE *fp )
|
||||
{
|
||||
char *cp;
|
||||
int c, string;
|
||||
|
|
@ -119,9 +118,8 @@ FILE *fp;
|
|||
return (cp != buffer);
|
||||
}
|
||||
|
||||
void readConfiguration( config )
|
||||
FILE *config;
|
||||
|
||||
void
|
||||
readConfiguration( FILE *config )
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
char *s;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
|
||||
#include "whois++.h"
|
||||
|
||||
void needHelp( reason )
|
||||
char *reason;
|
||||
void
|
||||
needHelp( char *reason )
|
||||
{
|
||||
char filename[MAXPATHLEN];
|
||||
char buffer[BUFSIZ];
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
*/
|
||||
|
||||
#include "whois++.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void showTemplate( template )
|
||||
char *template;
|
||||
|
||||
void
|
||||
showTemplate( char *template )
|
||||
{
|
||||
char filename[MAXPATHLEN], buffer[BUFSIZ];
|
||||
FILE *description;
|
||||
|
|
@ -57,9 +58,8 @@ char *template;
|
|||
}
|
||||
}
|
||||
|
||||
void listTemplates( query )
|
||||
char *query;
|
||||
|
||||
void
|
||||
listTemplates( char *query )
|
||||
{
|
||||
char filename[MAXPATHLEN];
|
||||
DIR *dir;
|
||||
|
|
@ -89,9 +89,8 @@ char *query;
|
|||
}
|
||||
}
|
||||
|
||||
char **specifyAttributes( objectClass )
|
||||
char *objectClass;
|
||||
|
||||
char **
|
||||
specifyAttributes( char *objectClass )
|
||||
{
|
||||
FILE *description;
|
||||
char filename[MAXPATHLEN], buffer[BUFSIZ];
|
||||
|
|
@ -131,9 +130,8 @@ char *objectClass;
|
|||
return attributes;
|
||||
}
|
||||
|
||||
char *templateToObjectClass( template )
|
||||
char *template;
|
||||
|
||||
char *
|
||||
templateToObjectClass( char *template )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -151,9 +149,8 @@ char *template;
|
|||
return template;
|
||||
}
|
||||
|
||||
char *objectClassToTemplate( objectClass )
|
||||
char *objectClass;
|
||||
|
||||
char *
|
||||
objectClassToTemplate( char *objectClass )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
|
|
@ -41,12 +43,12 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
#include <langinfo.h>
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include <ac/unistd.h>
|
||||
|
||||
static void handler();
|
||||
|
||||
char *lowerCase( string )
|
||||
char *string;
|
||||
static void handler(int sig);
|
||||
|
||||
char *
|
||||
lowerCase( char *string )
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
|
@ -56,9 +58,8 @@ char *string;
|
|||
return string;
|
||||
}
|
||||
|
||||
char *convertTime( date, locale )
|
||||
char *date, *locale;
|
||||
|
||||
char *
|
||||
convertTime( char *date, char *locale )
|
||||
{
|
||||
/*
|
||||
* A quick hack to convert the time from the format Quipu uses into
|
||||
|
|
@ -96,9 +97,8 @@ char *date, *locale;
|
|||
|
||||
static long interrupt;
|
||||
|
||||
char *getPassword( prompt )
|
||||
char *prompt;
|
||||
|
||||
char *
|
||||
getPassword( char *prompt )
|
||||
{
|
||||
#if defined(SYS5) || defined(XOS_2)
|
||||
struct termios ttyb;
|
||||
|
|
@ -107,7 +107,6 @@ char *prompt;
|
|||
#endif
|
||||
FILE *input;
|
||||
struct sigvec ovec, vec;
|
||||
void handler();
|
||||
unsigned long flags;
|
||||
int c, idx;
|
||||
static char buffer[BUFSIZ + 1];
|
||||
|
|
@ -160,8 +159,8 @@ char *prompt;
|
|||
return buffer;
|
||||
}
|
||||
|
||||
static void handler()
|
||||
|
||||
static void
|
||||
handler( int sig )
|
||||
{
|
||||
++interrupt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ static char copyright[] = "Copyright 1992 The University of Adelaide";
|
|||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
char *version()
|
||||
|
||||
char *version( void )
|
||||
{
|
||||
return "1.7";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,9 +139,10 @@ EXTERN char *banner;
|
|||
EXTERN char **category;
|
||||
EXTERN table *templateTranslationTable;
|
||||
|
||||
extern int displayDescribe(), parseCommand();
|
||||
extern void needHelp();
|
||||
extern void showTemplate(), listTemplates();
|
||||
extern char **specifyAttributes();
|
||||
extern char *lowerCase(), *version(), *attributeLabel();
|
||||
extern int displayDescribe(), parseCommand(char *query);
|
||||
extern void needHelp(char *reason);
|
||||
extern void showTemplate(char *template), listTemplates(char *query);
|
||||
extern char **specifyAttributes(char *objectClass);
|
||||
extern char *lowerCase(char *string), *version(void), *attributeLabel();
|
||||
extern char *rfc931_name();
|
||||
extern char *templateToObjectClass(char *template);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ LDAP_F caddr_t
|
|||
avl_getfirst LDAP_P((Avlnode *));
|
||||
|
||||
#ifdef AVL_REENTRANT
|
||||
/* ??? avl.c does not provide this version ??? */
|
||||
LDAP_F caddr_t
|
||||
avl_getnext LDAP_P((Avlnode *, caddr_t ));
|
||||
#else
|
||||
|
|
@ -74,9 +75,15 @@ avl_getnext LDAP_P((void));
|
|||
LDAP_F int
|
||||
avl_dup_error LDAP_P((void));
|
||||
|
||||
LDAP_F int
|
||||
avl_dup_ok LDAP_P((void));
|
||||
|
||||
LDAP_F int
|
||||
avl_apply LDAP_P((Avlnode *, IFP, caddr_t, int, int));
|
||||
|
||||
LDAP_F int
|
||||
avl_prefixapply LDAP_P((Avlnode *, caddr_t, IFP, caddr_t, IFP, caddr_t, int));
|
||||
|
||||
/* apply traversal types */
|
||||
#define AVL_PREORDER 1
|
||||
#define AVL_INORDER 2
|
||||
|
|
|
|||
|
|
@ -147,7 +147,6 @@ LDAP_F int ber_start_set LDAP_P(( BerElement *ber, unsigned long tag ));
|
|||
LDAP_F int ber_put_seq LDAP_P(( BerElement *ber ));
|
||||
LDAP_F int ber_put_set LDAP_P(( BerElement *ber ));
|
||||
LDAP_F int ber_printf LDAP_P(( BerElement *ber, char *fmt, ... ));
|
||||
LDAP_F int ber_fatten LDAP_P(( BerElement *ber, struct berval **bvPtr));
|
||||
/*
|
||||
* in io.c:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -470,9 +470,13 @@ typedef struct ldap_url_desc {
|
|||
/* avoid pulling in headers */
|
||||
struct timeval;
|
||||
|
||||
/*
|
||||
* in options.c:
|
||||
*/
|
||||
LDAP_F int ldap_get_option LDAP_P((LDAP *ld, int option, void *outvalue));
|
||||
LDAP_F int ldap_set_option LDAP_P((LDAP *ld, int option, void *invalue));
|
||||
|
||||
/* Not yet */
|
||||
LDAP_F void ldap_control_free LDAP_P(( LDAPControl *ctrl ));
|
||||
LDAP_F void ldap_controls_free LDAP_P(( LDAPControl **ctrls ));
|
||||
|
||||
|
|
@ -693,10 +697,10 @@ LDAP_F void cldap_setretryinfo LDAP_P(( LDAP *ld, int tries, int timeout ));
|
|||
*/
|
||||
LDAP_F int ldap_sort_entries LDAP_P(( LDAP *ld,
|
||||
LDAPMessage **chain, char *attr,
|
||||
int (*cmp) LDAP_P((const char *, const char *)) ));
|
||||
int (*cmp) (const char *, const char *) ));
|
||||
LDAP_F int ldap_sort_values LDAP_P(( LDAP *ld,
|
||||
char **vals, int (*cmp) LDAP_P((const void *, const void *)) ));
|
||||
LDAP_F int ldap_sort_strcasecmp LDAP_P(( char **a, char **b ));
|
||||
char **vals, int (*cmp) (const void *, const void *) ));
|
||||
LDAP_F int ldap_sort_strcasecmp LDAP_P(( const void *a, const void *b ));
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -6,14 +6,27 @@
|
|||
* Include file for LDAP utility routine
|
||||
*/
|
||||
|
||||
/* ISC Base64 Routines */
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/* ISC Base64 Routines */
|
||||
/* base64.c */
|
||||
LDAP_F int b64_ntop LDAP_P((u_char const *, size_t, char *, size_t));
|
||||
LDAP_F int b64_pton LDAP_P((char const *, u_char *, size_t));
|
||||
/* detach.c */
|
||||
LDAP_F void lutil_detach LDAP_P((int debug, int do_close));
|
||||
/* passwd.c */
|
||||
LDAP_F int lutil_passwd LDAP_P((const char *cred, const char *passwd));
|
||||
|
||||
/* strdup.c */
|
||||
#ifndef HAVE_STRDUP
|
||||
char *strdup (); /* No prototype, might conflict with someone else''s */
|
||||
#endif
|
||||
|
||||
/* tempnam.c */
|
||||
#ifndef HAVE_TEMPNAM
|
||||
LDAP_F char *tempnam (); /* No prototype, might conflict with someone else''s */
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#endif /* _LUTIL_H */
|
||||
|
|
|
|||
|
|
@ -50,14 +50,15 @@ static char avl_version[] = "AVL library version 1.0\n";
|
|||
* and balance of an avl tree.
|
||||
*/
|
||||
|
||||
static
|
||||
int ravl_insert( iroot, data, taller, fcmp, fdup, depth )
|
||||
Avlnode **iroot;
|
||||
caddr_t data;
|
||||
int *taller;
|
||||
IFP fcmp; /* comparison function */
|
||||
IFP fdup; /* function to call for duplicates */
|
||||
int depth;
|
||||
static int
|
||||
ravl_insert(
|
||||
Avlnode **iroot,
|
||||
caddr_t data,
|
||||
int *taller,
|
||||
IFP fcmp, /* comparison function */
|
||||
IFP fdup, /* function to call for duplicates */
|
||||
int depth
|
||||
)
|
||||
{
|
||||
int rc, cmp, tallersub;
|
||||
Avlnode *l, *r;
|
||||
|
|
@ -204,11 +205,8 @@ int ravl_insert( iroot, data, taller, fcmp, fdup, depth )
|
|||
* NOTE: this routine may malloc memory
|
||||
*/
|
||||
|
||||
int avl_insert( root, data, fcmp, fdup )
|
||||
Avlnode **root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
IFP fdup;
|
||||
int
|
||||
avl_insert( Avlnode **root, caddr_t data, IFP fcmp, IFP fdup )
|
||||
{
|
||||
int taller;
|
||||
|
||||
|
|
@ -221,8 +219,7 @@ int avl_insert( root, data, fcmp, fdup )
|
|||
*/
|
||||
|
||||
static int
|
||||
right_balance( root )
|
||||
Avlnode **root;
|
||||
right_balance( Avlnode **root )
|
||||
{
|
||||
int shorter = -1;
|
||||
Avlnode *r, *l;
|
||||
|
|
@ -285,9 +282,8 @@ right_balance( root )
|
|||
* been shortened because of a deletion.
|
||||
*/
|
||||
|
||||
static
|
||||
int left_balance( root )
|
||||
Avlnode **root;
|
||||
static int
|
||||
left_balance( Avlnode **root )
|
||||
{
|
||||
int shorter = -1;
|
||||
Avlnode *r, *l;
|
||||
|
|
@ -353,11 +349,7 @@ int left_balance( root )
|
|||
*/
|
||||
|
||||
static caddr_t
|
||||
ravl_delete( root, data, fcmp, shorter )
|
||||
Avlnode **root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
int *shorter;
|
||||
ravl_delete( Avlnode **root, caddr_t data, IFP fcmp, int *shorter )
|
||||
{
|
||||
int shortersubtree = 0;
|
||||
int cmp;
|
||||
|
|
@ -446,22 +438,15 @@ ravl_delete( root, data, fcmp, shorter )
|
|||
*/
|
||||
|
||||
caddr_t
|
||||
avl_delete( root, data, fcmp )
|
||||
Avlnode **root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
avl_delete( Avlnode **root, caddr_t data, IFP fcmp )
|
||||
{
|
||||
int shorter;
|
||||
|
||||
return( ravl_delete( root, data, fcmp, &shorter ) );
|
||||
}
|
||||
|
||||
static
|
||||
int avl_inapply( root, fn, arg, stopflag )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
static int
|
||||
avl_inapply( Avlnode *root, IFP fn, caddr_t arg, int stopflag )
|
||||
{
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
|
@ -480,12 +465,8 @@ int avl_inapply( root, fn, arg, stopflag )
|
|||
return( avl_inapply( root->avl_right, fn, arg, stopflag ) );
|
||||
}
|
||||
|
||||
static
|
||||
int avl_postapply( root, fn, arg, stopflag )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
static int
|
||||
avl_postapply( Avlnode *root, IFP fn, caddr_t arg, int stopflag )
|
||||
{
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
|
@ -503,12 +484,8 @@ int avl_postapply( root, fn, arg, stopflag )
|
|||
return( (*fn)( root->avl_data, arg ) );
|
||||
}
|
||||
|
||||
static
|
||||
int avl_preapply( root, fn, arg, stopflag )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
static int
|
||||
avl_preapply( Avlnode *root, IFP fn, caddr_t arg, int stopflag )
|
||||
{
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
|
@ -535,12 +512,8 @@ int avl_preapply( root, fn, arg, stopflag )
|
|||
* of nodes.
|
||||
*/
|
||||
|
||||
int avl_apply( root, fn, arg, stopflag, type )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
int type;
|
||||
int
|
||||
avl_apply( Avlnode *root, IFP fn, caddr_t arg, int stopflag, int type )
|
||||
{
|
||||
switch ( type ) {
|
||||
case AVL_INORDER:
|
||||
|
|
@ -568,14 +541,16 @@ int avl_apply( root, fn, arg, stopflag, type )
|
|||
* AVL_NOMORE is returned.
|
||||
*/
|
||||
|
||||
int avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
|
||||
Avlnode *root;
|
||||
caddr_t data;
|
||||
IFP fmatch;
|
||||
caddr_t marg;
|
||||
IFP fcmp;
|
||||
caddr_t carg;
|
||||
int stopflag;
|
||||
int
|
||||
avl_prefixapply(
|
||||
Avlnode *root,
|
||||
caddr_t data,
|
||||
IFP fmatch,
|
||||
caddr_t marg,
|
||||
IFP fcmp,
|
||||
caddr_t carg,
|
||||
int stopflag
|
||||
)
|
||||
{
|
||||
int cmp;
|
||||
|
||||
|
|
@ -617,9 +592,8 @@ int avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
|
|||
* number of items actually freed is returned.
|
||||
*/
|
||||
|
||||
int avl_free( root, dfree )
|
||||
Avlnode *root;
|
||||
IFP dfree;
|
||||
int
|
||||
avl_free( Avlnode *root, IFP dfree )
|
||||
{
|
||||
int nleft, nright;
|
||||
|
||||
|
|
@ -647,10 +621,7 @@ int avl_free( root, dfree )
|
|||
*/
|
||||
|
||||
caddr_t
|
||||
avl_find( root, data, fcmp )
|
||||
Avlnode *root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
avl_find( Avlnode *root, caddr_t data, IFP fcmp )
|
||||
{
|
||||
int cmp;
|
||||
|
||||
|
|
@ -672,10 +643,7 @@ avl_find( root, data, fcmp )
|
|||
*/
|
||||
|
||||
caddr_t
|
||||
avl_find_lin( root, data, fcmp )
|
||||
Avlnode *root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
avl_find_lin( Avlnode *root, caddr_t data, IFP fcmp )
|
||||
{
|
||||
caddr_t res;
|
||||
|
||||
|
|
@ -703,10 +671,8 @@ static int avl_nextlist;
|
|||
#define AVL_GRABSIZE 100
|
||||
|
||||
/* ARGSUSED */
|
||||
static
|
||||
int avl_buildlist( data, arg )
|
||||
caddr_t data;
|
||||
int arg;
|
||||
static int
|
||||
avl_buildlist( caddr_t data, int arg )
|
||||
{
|
||||
static int slots;
|
||||
|
||||
|
|
@ -738,8 +704,7 @@ int avl_buildlist( data, arg )
|
|||
*/
|
||||
|
||||
caddr_t
|
||||
avl_getfirst( root )
|
||||
Avlnode *root;
|
||||
avl_getfirst( Avlnode *root )
|
||||
{
|
||||
if ( avl_list ) {
|
||||
free( (char *) avl_list);
|
||||
|
|
@ -757,7 +722,7 @@ avl_getfirst( root )
|
|||
}
|
||||
|
||||
caddr_t
|
||||
avl_getnext()
|
||||
avl_getnext( void )
|
||||
{
|
||||
if ( avl_list == 0 )
|
||||
return( 0 );
|
||||
|
|
@ -771,12 +736,14 @@ avl_getnext()
|
|||
return( avl_list[ avl_nextlist++ ] );
|
||||
}
|
||||
|
||||
int avl_dup_error()
|
||||
int
|
||||
avl_dup_error( void )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
int avl_dup_ok()
|
||||
int
|
||||
avl_dup_ok( void )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@
|
|||
|
||||
#include <ac/string.h>
|
||||
#include <sys/types.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "avl.h"
|
||||
|
||||
static void ravl_print LDAP_P(( Avlnode *root, int depth ));
|
||||
static void myprint LDAP_P(( Avlnode *root ));
|
||||
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
Avlnode *tree = NULLAVL;
|
||||
char command[ 10 ];
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#endif /* LDAP_DEBUG && LDAP_LIBUI */
|
||||
#include <ac/string.h>
|
||||
|
||||
#include "lber-int.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <ac/stdarg.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static int BerWrite LDAP_P(( Sockbuf *sb, char *buf, long len ));
|
|||
|
||||
#define EXBUFSIZ 1024
|
||||
|
||||
int
|
||||
static int
|
||||
ber_filbuf( Sockbuf *sb, long len )
|
||||
{
|
||||
short rc;
|
||||
|
|
@ -151,7 +151,7 @@ ber_filbuf( Sockbuf *sb, long len )
|
|||
}
|
||||
|
||||
|
||||
long
|
||||
static long
|
||||
BerRead( Sockbuf *sb, char *buf, long len )
|
||||
{
|
||||
int c;
|
||||
|
|
@ -340,13 +340,13 @@ ber_alloc_t( int options )
|
|||
}
|
||||
|
||||
BerElement *
|
||||
ber_alloc()
|
||||
ber_alloc( void )
|
||||
{
|
||||
return( ber_alloc_t( 0 ) );
|
||||
}
|
||||
|
||||
BerElement *
|
||||
der_alloc()
|
||||
der_alloc( void )
|
||||
{
|
||||
return( ber_alloc_t( LBER_USE_DER ) );
|
||||
}
|
||||
|
|
@ -473,7 +473,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
|
|||
unsigned long tag = 0, netlen, toread;
|
||||
unsigned char lc;
|
||||
long rc;
|
||||
int noctets, diff;
|
||||
unsigned int noctets, diff;
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
if ( lber_debug )
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ static char copyright[] = "@(#) Copyright (c) 1990, 1994 Regents of the Universi
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
@ -291,8 +292,8 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
|
|||
tv.tv_usec = 0;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"cldap_result waiting up to %d seconds for a response\n",
|
||||
tv.tv_sec, 0, 0 );
|
||||
"cldap_result waiting up to %ld seconds for a response\n",
|
||||
(long) tv.tv_sec, 0, 0 );
|
||||
ber_init_w_nullc( &ber, 0 );
|
||||
ldap_set_ber_options( ld, &ber );
|
||||
|
||||
|
|
@ -464,7 +465,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
|
|||
bv = NULL;
|
||||
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %d\n",
|
||||
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %lu\n",
|
||||
tag, 0, 0 );
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
break; /* return w/error */
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <ac/ctype.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
extern char *strtok (char *, const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
#include "ldapconfig.h"
|
||||
|
|
@ -28,7 +30,7 @@ struct ol_keyvalue {
|
|||
int value;
|
||||
};
|
||||
|
||||
struct ol_keyvalue deref_kv[] = {
|
||||
static struct ol_keyvalue deref_kv[] = {
|
||||
{"never", LDAP_DEREF_NEVER},
|
||||
{"searching", LDAP_DEREF_SEARCHING},
|
||||
{"finding", LDAP_DEREF_FINDING},
|
||||
|
|
@ -36,7 +38,7 @@ struct ol_keyvalue deref_kv[] = {
|
|||
{NULL, 0}
|
||||
};
|
||||
|
||||
struct ol_attribute {
|
||||
static struct ol_attribute {
|
||||
int type;
|
||||
char* name;
|
||||
void* data;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ void ldap_add_result_to_cache LDAP_P(( LDAP *ld, LDAPMessage *result ));
|
|||
int ldap_check_cache LDAP_P(( LDAP *ld, unsigned long msgtype, BerElement *request ));
|
||||
|
||||
/*
|
||||
* in dparse.c
|
||||
* in dsparse.c
|
||||
*/
|
||||
int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
|
||||
void free_strarray LDAP_P(( char **sap ));
|
||||
|
|
@ -227,6 +227,12 @@ int ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadref
|
|||
int ldap_append_referral( LDAP *ld, char **referralsp, char *s );
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
|
||||
/*
|
||||
* in result.c:
|
||||
*/
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
LDAP_F int cldap_getmsg ( LDAP *ld, struct timeval *timeout, BerElement *ber );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* in search.c
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
|
|||
|
||||
|
||||
void *
|
||||
ldap_new_select_info()
|
||||
ldap_new_select_info( void )
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of
|
|||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@ struct entrything {
|
|||
LDAPMessage *et_msg;
|
||||
};
|
||||
|
||||
static int (*et_cmp_fn) LDAP_P(( char *a, char *b ));
|
||||
static int (*et_cmp_fn) LDAP_P(( const char *a, const char *b ));
|
||||
static int et_cmp LDAP_P(( const void *aa, const void *bb));
|
||||
|
||||
|
||||
int
|
||||
ldap_sort_strcasecmp(
|
||||
char **a,
|
||||
char **b
|
||||
const void *a,
|
||||
const void *b
|
||||
)
|
||||
{
|
||||
return( strcasecmp( *a, *b ) );
|
||||
return( strcasecmp( *(char *const *)a, *(char *const *)b ) );
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -78,7 +78,7 @@ ldap_sort_entries(
|
|||
LDAP *ld,
|
||||
LDAPMessage **chain,
|
||||
char *attr, /* NULL => sort by DN */
|
||||
int (*cmp) LDAP_P((const char *, const char *))
|
||||
int (*cmp) (const char *, const char *)
|
||||
)
|
||||
{
|
||||
int i, count;
|
||||
|
|
@ -131,7 +131,7 @@ int
|
|||
ldap_sort_values(
|
||||
LDAP *ld,
|
||||
char **vals,
|
||||
int (*cmp) LDAP_P((const void *, const void *))
|
||||
int (*cmp) (const void *, const void *)
|
||||
)
|
||||
{
|
||||
int nel;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
@ -26,6 +27,13 @@
|
|||
*/
|
||||
#include "ldap-int.h"
|
||||
|
||||
/* local functions */
|
||||
#ifndef HAVE_GETLINE
|
||||
static char *getline LDAP_P(( char *line, int len, FILE *fp, char *prompt ));
|
||||
#endif
|
||||
static char **get_list LDAP_P(( char *prompt ));
|
||||
static int file_read LDAP_P(( char *path, struct berval *bv ));
|
||||
static LDAPMod **get_modlist LDAP_P(( char *prompt1, char *prompt2, char *prompt3 ));
|
||||
static void handle_result LDAP_P(( LDAP *ld, LDAPMessage *lm ));
|
||||
static void print_ldap_result LDAP_P(( LDAP *ld, LDAPMessage *lm, char *s ));
|
||||
static void print_search_entry LDAP_P(( LDAP *ld, LDAPMessage *res ));
|
||||
|
|
@ -33,7 +41,7 @@ static void free_list LDAP_P(( char **list ));
|
|||
|
||||
#define NOCACHEERRMSG "don't compile with -DLDAP_NOCACHE if you desire local caching"
|
||||
|
||||
char *dnsuffix;
|
||||
static char *dnsuffix;
|
||||
|
||||
#ifndef HAVE_GETLINE
|
||||
static char *
|
||||
|
|
@ -215,7 +223,7 @@ get_modlist( char *prompt1, char *prompt2, char *prompt3 )
|
|||
|
||||
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
int
|
||||
static int
|
||||
bind_prompt( LDAP *ld, char **dnp, char **passwdp, int *authmethodp,
|
||||
int freeit )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "ldap-int.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
/* local functions */
|
||||
static int do_entry2text LDAP_P((
|
||||
LDAP *ld, char *buf, char *base, LDAPMessage *entry,
|
||||
struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
#include "disptmpl.h"
|
||||
#include "srchpref.h"
|
||||
|
||||
void dump_tmpl LDAP_P(( struct ldap_disptmpl *tmpl ));
|
||||
void dump_srchpref LDAP_P(( struct ldap_searchobj *sp ));
|
||||
static void dump_tmpl ( struct ldap_disptmpl *tmpl );
|
||||
static void dump_srchpref( struct ldap_searchobj *sp );
|
||||
|
||||
#define NULLSTRINGIFNULL( s ) ( s == NULL ? "(null)" : s )
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
|
|||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
typedef int (*cancelptype) LDAP_P(( void *cancelparm ));
|
||||
|
||||
/* local functions */
|
||||
static int ldap_ufn_search_ctx LDAP_P(( LDAP *ld, char **ufncomp, int ncomp,
|
||||
char *prefix, char **attrs, int attrsonly, LDAPMessage **res,
|
||||
cancelptype cancelproc, void *cancelparm, char *tag1, char *tag2,
|
||||
|
|
@ -71,7 +73,6 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
|
|||
LDAPFiltInfo *fi;
|
||||
LDAPMessage *tmpcand;
|
||||
LDAPMessage *candidates;
|
||||
LDAPMessage *ldap_msg_merge(), *ldap_ufn_expand();
|
||||
static char *objattrs[] = { "objectClass", NULL };
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -30,10 +30,12 @@ static char copyright[] = "@(#) Copyright (c) 1996 Regents of the University of
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern char *strdup (const char *);
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
||||
/* local functions */
|
||||
static int skip_url_prefix LDAP_P(( char **urlp, int *enclosedp ));
|
||||
static void hex_unescape LDAP_P(( char *s ));
|
||||
static int unhex( char c );
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/errno.h>
|
||||
|
||||
#include "ldbm.h"
|
||||
|
|
@ -317,7 +318,7 @@ ldbm_datum_dup( LDBM ldbm, Datum data )
|
|||
return( dup );
|
||||
}
|
||||
dup.dsize = data.dsize;
|
||||
if ( dup.dptr = (char *) malloc( data.dsize ) )
|
||||
if ( (dup.dptr = (char *) malloc( data.dsize )) != NULL )
|
||||
memcpy( dup.dptr, data.dptr, data.dsize );
|
||||
|
||||
return( dup );
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ pthread_create(
|
|||
}
|
||||
|
||||
void
|
||||
pthread_yield()
|
||||
pthread_yield( void )
|
||||
{
|
||||
cthread_yield();
|
||||
}
|
||||
|
|
@ -223,7 +223,7 @@ pthread_create(
|
|||
#endif /* ! sunos56 */
|
||||
|
||||
void
|
||||
pthread_yield()
|
||||
pthread_yield( void )
|
||||
{
|
||||
thr_yield();
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ pthread_create(
|
|||
}
|
||||
|
||||
void
|
||||
pthread_yield()
|
||||
pthread_yield( void )
|
||||
{
|
||||
lwp_yield( SELF );
|
||||
}
|
||||
|
|
@ -525,7 +525,7 @@ pthread_create(
|
|||
}
|
||||
|
||||
void
|
||||
pthread_yield()
|
||||
pthread_yield( void )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,17 +45,14 @@
|
|||
surprised if they were a performance bottleneck for MD5. */
|
||||
|
||||
static uint32
|
||||
getu32 (addr)
|
||||
const unsigned char *addr;
|
||||
getu32( const unsigned char *addr )
|
||||
{
|
||||
return (((((unsigned long)addr[3] << 8) | addr[2]) << 8)
|
||||
| addr[1]) << 8 | addr[0];
|
||||
}
|
||||
|
||||
static void
|
||||
putu32 (data, addr)
|
||||
uint32 data;
|
||||
unsigned char *addr;
|
||||
putu32( uint32 data, unsigned char *addr )
|
||||
{
|
||||
addr[0] = (unsigned char)data;
|
||||
addr[1] = (unsigned char)(data >> 8);
|
||||
|
|
@ -68,8 +65,7 @@ putu32 (data, addr)
|
|||
* initialization constants.
|
||||
*/
|
||||
void
|
||||
ldap_MD5Init(ctx)
|
||||
struct ldap_MD5Context *ctx;
|
||||
ldap_MD5Init( struct ldap_MD5Context *ctx )
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
|
|
@ -85,10 +81,11 @@ ldap_MD5Init(ctx)
|
|||
* of bytes.
|
||||
*/
|
||||
void
|
||||
ldap_MD5Update(ctx, buf, len)
|
||||
struct ldap_MD5Context *ctx;
|
||||
unsigned char const *buf;
|
||||
unsigned len;
|
||||
ldap_MD5Update(
|
||||
struct ldap_MD5Context *ctx,
|
||||
const unsigned char *buf,
|
||||
unsigned int len
|
||||
)
|
||||
{
|
||||
uint32 t;
|
||||
|
||||
|
|
@ -136,9 +133,7 @@ ldap_MD5Update(ctx, buf, len)
|
|||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void
|
||||
ldap_MD5Final(digest, ctx)
|
||||
unsigned char digest[16];
|
||||
struct ldap_MD5Context *ctx;
|
||||
ldap_MD5Final( unsigned char *digest, struct ldap_MD5Context *ctx )
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
|
@ -199,9 +194,7 @@ ldap_MD5Final(digest, ctx)
|
|||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void
|
||||
ldap_MD5Transform(buf, inraw)
|
||||
uint32 buf[4];
|
||||
const unsigned char inraw[64];
|
||||
ldap_MD5Transform( uint32 *buf, const unsigned char *inraw )
|
||||
{
|
||||
register uint32 a, b, c, d;
|
||||
uint32 in[16];
|
||||
|
|
@ -296,7 +289,7 @@ ldap_MD5Transform(buf, inraw)
|
|||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
main (int argc, char **argv )
|
||||
{
|
||||
struct ldap_MD5Context context;
|
||||
unsigned char checksum[16];
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "lutil_md5.h"
|
||||
#include "lutil_sha1.h"
|
||||
#include "lutil.h"
|
||||
extern char *crypt (const char *, const char *);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#ifndef HAVE_SETPROCTITLE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -57,9 +57,8 @@
|
|||
/*
|
||||
* Hash a single 512-bit block. This is the core of the algorithm.
|
||||
*/
|
||||
void ldap_SHA1Transform(state, buffer)
|
||||
uint32 state[5];
|
||||
const unsigned char buffer[64];
|
||||
void
|
||||
ldap_SHA1Transform( uint32 *state, const unsigned char *buffer )
|
||||
{
|
||||
uint32 a, b, c, d, e;
|
||||
typedef union {
|
||||
|
|
@ -69,8 +68,8 @@ void ldap_SHA1Transform(state, buffer)
|
|||
CHAR64LONG16 *block;
|
||||
|
||||
#ifdef SHA1HANDSOFF
|
||||
static unsigned char workspace[64];
|
||||
block = (CHAR64LONG16 *)workspace;
|
||||
CHAR64LONG16 workspace;
|
||||
block = &workspace;
|
||||
(void)memcpy(block, buffer, 64);
|
||||
#else
|
||||
block = (CHAR64LONG16 *)buffer;
|
||||
|
|
@ -120,8 +119,8 @@ void ldap_SHA1Transform(state, buffer)
|
|||
/*
|
||||
* ldap_SHA1Init - Initialize new context
|
||||
*/
|
||||
void ldap_SHA1Init(context)
|
||||
ldap_SHA1_CTX *context;
|
||||
void
|
||||
ldap_SHA1Init( ldap_SHA1_CTX *context )
|
||||
{
|
||||
|
||||
/* SHA1 initialization constants */
|
||||
|
|
@ -137,10 +136,12 @@ void ldap_SHA1Init(context)
|
|||
/*
|
||||
* Run your data through this.
|
||||
*/
|
||||
void ldap_SHA1Update(context, data, len)
|
||||
ldap_SHA1_CTX *context;
|
||||
const unsigned char *data;
|
||||
u_int len;
|
||||
void
|
||||
ldap_SHA1Update(
|
||||
ldap_SHA1_CTX *context,
|
||||
const unsigned char *data,
|
||||
u_int len
|
||||
)
|
||||
{
|
||||
u_int i, j;
|
||||
|
||||
|
|
@ -164,9 +165,8 @@ void ldap_SHA1Update(context, data, len)
|
|||
/*
|
||||
* Add padding and return the message digest.
|
||||
*/
|
||||
void ldap_SHA1Final(digest, context)
|
||||
unsigned char digest[20];
|
||||
ldap_SHA1_CTX* context;
|
||||
void
|
||||
ldap_SHA1Final( unsigned char *digest, ldap_SHA1_CTX *context )
|
||||
{
|
||||
u_int i;
|
||||
unsigned char finalcount[8];
|
||||
|
|
@ -225,9 +225,7 @@ static char rcsid[] = "$OpenBSD: sha1hl.c,v 1.1 1997/07/12 20:06:03 millert Exp
|
|||
|
||||
/* ARGSUSED */
|
||||
char *
|
||||
ldap_SHA1End(ctx, buf)
|
||||
ldap_SHA1_CTX *ctx;
|
||||
char *buf;
|
||||
ldap_SHA1End( ldap_SHA1_CTX *ctx, char *buf )
|
||||
{
|
||||
int i;
|
||||
char *p = buf;
|
||||
|
|
@ -247,9 +245,7 @@ ldap_SHA1End(ctx, buf)
|
|||
}
|
||||
|
||||
char *
|
||||
ldap_SHA1File (filename, buf)
|
||||
char *filename;
|
||||
char *buf;
|
||||
ldap_SHA1File( char *filename, char *buf )
|
||||
{
|
||||
unsigned char buffer[BUFSIZ];
|
||||
ldap_SHA1_CTX ctx;
|
||||
|
|
@ -270,10 +266,7 @@ ldap_SHA1File (filename, buf)
|
|||
}
|
||||
|
||||
char *
|
||||
ldap_SHA1Data (data, len, buf)
|
||||
const unsigned char *data;
|
||||
size_t len;
|
||||
char *buf;
|
||||
ldap_SHA1Data( const unsigned char *data, size_t len, char *buf )
|
||||
{
|
||||
ldap_SHA1_CTX ctx;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@
|
|||
|
||||
#ifndef HAVE_STRDUP
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
#include "lutil.h"
|
||||
|
||||
char *strdup( const char *s )
|
||||
{
|
||||
char *p;
|
||||
|
||||
if ( (p = (char *) malloc( strlen( s ) + 1 )) == NULL )
|
||||
return( NULL );
|
||||
return( (char *)0 );
|
||||
|
||||
strcpy( p, s );
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
#include "portable.h"
|
||||
|
||||
#ifndef HAVE_TEMPNAME
|
||||
#ifndef HAVE_TEMPNAM
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
extern char *mktemp (char *);
|
||||
|
||||
char *tempnam( char *dir, char *pfx )
|
||||
#include "lutil.h"
|
||||
|
||||
char *
|
||||
tempnam( char *dir, char *pfx )
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#ifdef LDAP_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#define ADDTAG (ldap_compat == 20 ? OLD_LDAP_RES_ADD : LDAP_RES_ADD)
|
||||
#else
|
||||
#define ADDTAG LDAP_RES_ADD
|
||||
|
|
@ -47,7 +46,6 @@ do_add(
|
|||
unsigned long tag, len;
|
||||
struct ds_addentry_arg aa;
|
||||
static CommonArgs common = default_common_args;
|
||||
extern DN ldap_str2dn();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -90,7 +88,7 @@ do_add(
|
|||
aa.ada_entry = NULLATTR;
|
||||
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
|
||||
tag = ber_next_element( ber, &len, last ) ) {
|
||||
Attr_Sequence as, get_as();
|
||||
Attr_Sequence as;
|
||||
|
||||
if ( ber_scanf( ber, "{a{V}}", &type, &bvals ) == LBER_ERROR )
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,17 +18,19 @@
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
extern int errno;
|
||||
|
||||
#include <quipu/commonarg.h>
|
||||
#include <quipu/ds_error.h>
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#include <quipu/dap.h> /* get dap_unbind() */
|
||||
#if ISODEPACKAGE == IC
|
||||
#include <ll/isoaddrs.h>
|
||||
#else
|
||||
#include <isoaddrs.h>
|
||||
#endif
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
|
|
@ -44,11 +46,10 @@
|
|||
|
||||
struct conn *conns;
|
||||
|
||||
struct conn *conn_dup( struct conn *cn )
|
||||
struct conn *
|
||||
conn_dup( struct conn *cn )
|
||||
{
|
||||
struct conn *new;
|
||||
struct PSAPaddr *psap_cpy();
|
||||
|
||||
if ( (new = (struct conn *) malloc( sizeof(struct conn) )) == NULL )
|
||||
return( NULL );
|
||||
|
||||
|
|
@ -70,10 +71,9 @@ struct conn *conn_dup( struct conn *cn )
|
|||
}
|
||||
|
||||
int
|
||||
conn_init()
|
||||
conn_init( void )
|
||||
{
|
||||
extern char *dsa_address;
|
||||
struct PSAPaddr *addr, *psap_cpy();
|
||||
struct PSAPaddr *addr;
|
||||
|
||||
if ( (conns = (struct conn *) malloc( sizeof(struct conn) )) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "conn_init: malloc failed\n", 0, 0, 0 );
|
||||
|
|
@ -104,7 +104,6 @@ void
|
|||
conn_free( struct conn *conn )
|
||||
{
|
||||
struct timeval tv;
|
||||
extern int referral_connection_timeout;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "conn_free (%s): refcnt is %d\n",
|
||||
paddr2str( conn->c_paddr, NULLNA ), conn->c_refcnt, 0 );
|
||||
|
|
@ -173,7 +172,7 @@ conn_setfds( fd_set *fds )
|
|||
}
|
||||
|
||||
void
|
||||
conn_badfds()
|
||||
conn_badfds( void )
|
||||
{
|
||||
struct conn *tmp;
|
||||
|
||||
|
|
@ -186,7 +185,8 @@ conn_badfds()
|
|||
}
|
||||
}
|
||||
|
||||
struct conn *conn_getfd( fd_set *fds )
|
||||
struct conn *
|
||||
conn_getfd( fd_set *fds )
|
||||
{
|
||||
struct conn *tmp;
|
||||
|
||||
|
|
@ -226,7 +226,8 @@ psap_cmp( struct PSAPaddr *a, struct PSAPaddr *b )
|
|||
return( bcmp( (char *) a, (char *) b, sizeof(struct PSAPaddr) ) );
|
||||
}
|
||||
|
||||
struct conn *conn_find( struct conn *c )
|
||||
struct conn *
|
||||
conn_find( struct conn *c )
|
||||
{
|
||||
struct conn *tmp;
|
||||
|
||||
|
|
@ -263,7 +264,7 @@ struct conn *conn_find( struct conn *c )
|
|||
}
|
||||
|
||||
void
|
||||
conn_close()
|
||||
conn_close( void )
|
||||
{
|
||||
struct conn *tmp;
|
||||
|
||||
|
|
@ -277,7 +278,6 @@ int
|
|||
isclosed( int ad )
|
||||
{
|
||||
int o;
|
||||
extern int errno;
|
||||
|
||||
if ( ioctl( ad, FIOGETOWN, &o ) < 0 )
|
||||
return( errno == EBADF ? 1 : 0 );
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#ifdef LDAP_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#define BINDTAG (ldap_compat == 20 ? OLD_LDAP_RES_BIND : LDAP_RES_BIND)
|
||||
#else
|
||||
#define BINDTAG LDAP_RES_BIND
|
||||
|
|
@ -53,9 +52,7 @@ do_bind(
|
|||
unsigned long len;
|
||||
char *dn, *pw;
|
||||
char *matched;
|
||||
struct PSAPaddr *addr, *psap_cpy();
|
||||
extern char *dsa_address;
|
||||
extern int version;
|
||||
struct PSAPaddr *addr;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -99,7 +96,7 @@ do_bind(
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "do_bind: version %d dn (%s) method %d\n",
|
||||
Debug( LDAP_DEBUG_ARGS, "do_bind: version %d dn (%s) method %lu\n",
|
||||
version, dn, method );
|
||||
|
||||
if ( m->m_conn->c_paddr == NULLPA ) {
|
||||
|
|
@ -147,8 +144,6 @@ do_bind_real(
|
|||
#ifdef HAVE_KERBEROS
|
||||
u_long nonce;
|
||||
#endif
|
||||
extern DN ldap_str2dn();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_bind_real\n", 0, 0, 0 );
|
||||
|
||||
*matched = NULL;
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@
|
|||
#include <quipu/ds_search.h>
|
||||
#include <quipu/dap2.h>
|
||||
#include <quipu/dua.h>
|
||||
extern sntx_table *get_syntax_table( short int sntx );
|
||||
extern PE asn2pe( char * );
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "common.h"
|
||||
|
||||
int ldap_certif_print( PS ps, struct certificate *parm, int format )
|
||||
int
|
||||
ldap_certif_print( PS ps, struct certificate *parm, int format )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_certif_print()\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -114,7 +117,8 @@ ldap_print_algid( PS ps, struct alg_id *parm, int format )
|
|||
}
|
||||
}
|
||||
|
||||
struct certificate *ldap_str2cert( char *str )
|
||||
struct certificate *
|
||||
ldap_str2cert( char *str )
|
||||
{
|
||||
struct certificate *result;
|
||||
char *ptr;
|
||||
|
|
@ -280,8 +284,6 @@ OID oid;
|
|||
void
|
||||
ldap_str2alg( char *str, struct alg_id *alg )
|
||||
{
|
||||
PE asn2pe();
|
||||
|
||||
if ((str == NULLCP) || (*str == '\0'))
|
||||
{
|
||||
alg->asn = NULLPE;
|
||||
|
|
@ -305,11 +307,10 @@ PE asn2pe();
|
|||
}
|
||||
}
|
||||
|
||||
void certif_init()
|
||||
void
|
||||
certif_init( void )
|
||||
{
|
||||
extern short ldap_certif_syntax;
|
||||
sntx_table *syntax_table;
|
||||
extern sntx_table *get_syntax_table( short int sntx );
|
||||
|
||||
if ((syntax_table = get_syntax_table(ldap_certif_syntax)) != NULL) {
|
||||
syntax_table->s_print = (void *) ldap_certif_print;
|
||||
|
|
|
|||
|
|
@ -58,4 +58,64 @@ struct msg {
|
|||
#include "proto-ldapd.h"
|
||||
#include "ldap_log.h"
|
||||
|
||||
/* from ISODE */
|
||||
extern char *dsa_address;
|
||||
extern char *bound_dn, *bound_pw;
|
||||
struct PSAPaddr *psap_cpy(struct PSAPaddr *);
|
||||
|
||||
/* in association.c */
|
||||
extern struct conn *conns;
|
||||
|
||||
/* in main.c */
|
||||
#ifdef LDAP_DEBUG
|
||||
extern int ldap_debug;
|
||||
#endif
|
||||
extern int version;
|
||||
#ifdef LDAP_COMPAT
|
||||
extern int ldap_compat;
|
||||
#endif
|
||||
extern int dosyslog;
|
||||
extern int do_tcp;
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
extern int do_udp;
|
||||
#endif
|
||||
extern int idletime;
|
||||
extern int referral_connection_timeout;
|
||||
extern struct timeval conn_start_tv;
|
||||
#ifdef HAVE_KERBEROS
|
||||
extern char *krb_ldap_service;
|
||||
extern char *krb_x500_service;
|
||||
extern char *krb_x500_instance;
|
||||
extern char *krb_x500_nonce;
|
||||
extern char *kerberos_keyfile;
|
||||
#endif
|
||||
|
||||
/* syntax.c */
|
||||
extern short ldap_photo_syntax;
|
||||
extern short ldap_jpeg_syntax;
|
||||
extern short ldap_jpeg_nonfile_syntax;
|
||||
extern short ldap_audio_syntax;
|
||||
extern short ldap_dn_syntax;
|
||||
extern short ldap_postaladdress_syntax;
|
||||
extern short ldap_acl_syntax;
|
||||
extern short ldap_mtai_syntax;
|
||||
extern short ldap_rts_cred_syntax;
|
||||
extern short ldap_rtl_syntax;
|
||||
extern short ldap_mailbox_syntax;
|
||||
extern short ldap_caseignorelist_syntax;
|
||||
extern short ldap_caseexactstring_syntax;
|
||||
extern short ldap_certif_syntax;
|
||||
extern short ldap_iattr_syntax;
|
||||
extern short ldap_telex_syntax;
|
||||
extern short ldap_octetstring_syntax;
|
||||
extern short ldap_deliverymethod_syntax;
|
||||
extern short ldap_facsimileTelephoneNumber_syntax;
|
||||
extern short ldap_presentationAddress_syntax;
|
||||
extern short ldap_teletexTerminalIdentifier_syntax;
|
||||
extern short ldap_searchGuide_syntax;
|
||||
extern short ldap_dLSubmitPermission_syntax;
|
||||
|
||||
/* Version.c */
|
||||
extern char Versionstr[];
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#define COMPTAG (ldap_compat == 20 ? OLD_LDAP_RES_COMPARE : LDAP_RES_COMPARE)
|
||||
#else
|
||||
#define COMPTAG LDAP_RES_COMPARE
|
||||
|
|
@ -46,7 +45,6 @@ do_compare(
|
|||
struct ds_compare_arg ca;
|
||||
AttributeType type;
|
||||
static CommonArgs common = default_common_args;
|
||||
extern short ldap_dn_syntax;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#define DELTAG (ldap_compat == 20 ? OLD_LDAP_RES_DELETE : LDAP_RES_DELETE)
|
||||
#else
|
||||
#define DELTAG LDAP_RES_DELETE
|
||||
|
|
@ -54,7 +53,6 @@ do_delete(
|
|||
int rc;
|
||||
struct ds_removeentry_arg ra;
|
||||
static CommonArgs common = default_common_args;
|
||||
extern DN ldap_str2dn();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "ldap_log.h"
|
||||
#include "common.h" /* get ldap_dn_print() */
|
||||
|
||||
void
|
||||
print_error( struct DSError *e )
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ kerberosv4_ldap_auth( char *cred, long len )
|
|||
char instance[INST_SZ];
|
||||
int err;
|
||||
AUTH_DAT ad;
|
||||
extern char *krb_ldap_service;
|
||||
extern char *kerberos_keyfile;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "kerberosv4_ldap_auth\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -72,8 +70,6 @@ kerberosv4_bindarg(
|
|||
struct timeval tv;
|
||||
char realm[REALM_SZ];
|
||||
int err;
|
||||
extern char *krb_x500_service;
|
||||
extern char *krb_x500_instance;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "kerberosv4_bindarg\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -49,12 +49,11 @@ int allow_severity = LOG_INFO;
|
|||
int deny_severity = LOG_NOTICE;
|
||||
#endif /* TCP_WRAPPERS */
|
||||
|
||||
void log_and_exit();
|
||||
static int set_socket();
|
||||
static void do_queries();
|
||||
static RETSIGTYPE wait4child();
|
||||
static int set_socket( int port, int udp );
|
||||
static void do_queries( int clientsock, int udp );
|
||||
static RETSIGTYPE wait4child( int sig );
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
static int udp_init();
|
||||
static int udp_init( int port, int createsocket );
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
|
|
@ -83,8 +82,6 @@ char *kerberos_keyfile;
|
|||
int dtblsize;
|
||||
int RunFromInetd = 0;
|
||||
|
||||
extern char Versionstr[];
|
||||
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
|
|
@ -102,9 +99,7 @@ usage( char *name )
|
|||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
int tcps, ns;
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
|
|
@ -119,7 +114,6 @@ char **argv;
|
|||
int len;
|
||||
int dsapargc;
|
||||
char **dsapargv;
|
||||
RETSIGTYPE wait4child();
|
||||
#ifdef LDAP_PROCTITLE
|
||||
char title[80];
|
||||
#endif
|
||||
|
|
@ -275,8 +269,8 @@ char **argv;
|
|||
lutil_detach( 0, 1 );
|
||||
# endif
|
||||
#endif
|
||||
(void) SIGNAL( SIGCHLD, (void *) wait4child );
|
||||
(void) SIGNAL( SIGINT, (void *) log_and_exit );
|
||||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
(void) SIGNAL( SIGINT, log_and_exit );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -450,7 +444,7 @@ char **argv;
|
|||
hp->h_name );
|
||||
#endif
|
||||
gettimeofday( &conn_start_tv, (struct timezone *) NULL );
|
||||
(void) SIGNAL( SIGPIPE, (void *) log_and_exit );
|
||||
(void) SIGNAL( SIGPIPE, log_and_exit );
|
||||
|
||||
do_queries( ns, 0 );
|
||||
/* NOT REACHED */
|
||||
|
|
@ -466,7 +460,7 @@ char **argv;
|
|||
setproctitle( title );
|
||||
#endif
|
||||
gettimeofday( &conn_start_tv, (struct timezone *) NULL );
|
||||
(void) SIGNAL( SIGPIPE, (void *) log_and_exit );
|
||||
(void) SIGNAL( SIGPIPE, log_and_exit );
|
||||
|
||||
do_queries( ns, 0 );
|
||||
break;
|
||||
|
|
@ -539,7 +533,6 @@ do_queries(
|
|||
timeout.tv_usec = 0;
|
||||
for ( ;; ) {
|
||||
struct conn *dsaconn;
|
||||
extern struct conn *conns;
|
||||
|
||||
FD_ZERO( &readfds );
|
||||
FD_SET( clientsock, &readfds );
|
||||
|
|
@ -652,7 +645,8 @@ set_socket(
|
|||
return( s );
|
||||
}
|
||||
|
||||
static RETSIGTYPE wait4child()
|
||||
static RETSIGTYPE
|
||||
wait4child( int sig )
|
||||
{
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
|
|
@ -668,11 +662,11 @@ static RETSIGTYPE wait4child()
|
|||
; /* NULL */
|
||||
#endif
|
||||
|
||||
(void) SIGNAL( SIGCHLD, (void *) wait4child );
|
||||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RETSIGTYPE
|
||||
log_and_exit( int exitcode )
|
||||
{
|
||||
struct timeval tv;
|
||||
|
|
@ -700,9 +694,6 @@ udp_init(
|
|||
{
|
||||
int s, bound;
|
||||
char *matched;
|
||||
extern char *dsa_address;
|
||||
extern struct PSAPaddr *psap_cpy();
|
||||
extern struct conn *conns;
|
||||
|
||||
if ( createsocket )
|
||||
s = set_socket( port, 1 );
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <quipu/modify.h>
|
||||
#include <quipu/dap2.h>
|
||||
#include <quipu/dua.h>
|
||||
extern IFP merge_acl;
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
|
@ -31,22 +32,9 @@
|
|||
|
||||
static CommonArgs common = default_common_args;
|
||||
|
||||
extern short ldap_photo_syntax;
|
||||
extern short ldap_jpeg_syntax;
|
||||
extern short ldap_jpeg_nonfile_syntax;
|
||||
extern short ldap_audio_syntax;
|
||||
extern short ldap_dn_syntax;
|
||||
extern short ldap_postaladdress_syntax;
|
||||
extern short ldap_acl_syntax;
|
||||
extern short ldap_mtai_syntax;
|
||||
extern short ldap_rts_cred_syntax;
|
||||
extern short ldap_rtl_syntax;
|
||||
extern short ldap_octetstring_syntax;
|
||||
|
||||
static int replace_mod( struct entrymod *, Attr_Sequence, Attr_Sequence );
|
||||
|
||||
#ifdef LDAP_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#define MODTAG (ldap_compat == 20 ? OLD_LDAP_RES_MODIFY : LDAP_RES_MODIFY)
|
||||
#else
|
||||
#define MODTAG LDAP_RES_MODIFY
|
||||
|
|
@ -65,7 +53,6 @@ do_modify(
|
|||
unsigned long tag, len;
|
||||
LDAPMod *mods, *modtail;
|
||||
struct ds_read_arg ra;
|
||||
extern DN ldap_str2dn();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -183,7 +170,7 @@ do_modify2(
|
|||
ma.mea_changes = NULLMOD;
|
||||
for ( mods = m->m_mods; mods != NULL; mods = mods->mod_next ) {
|
||||
struct entrymod *em;
|
||||
Attr_Sequence as, new, get_as();
|
||||
Attr_Sequence as, new;
|
||||
|
||||
if ( (em = (struct entrymod *) calloc( 1,
|
||||
sizeof(struct entrymod) )) == NULLMOD ) {
|
||||
|
|
@ -401,9 +388,6 @@ get_as(
|
|||
AttributeValue av;
|
||||
int t61str, ncomp;
|
||||
char *sval, *s, *news, *n;
|
||||
extern IFP merge_acl;
|
||||
extern AttributeValue bv_asn2AttrV(), ldap_strdn2AttrV();
|
||||
extern AttributeValue ldap_str_at2AttrV(), bv_octet2AttrV();
|
||||
|
||||
if ( syntax == ldap_jpeg_syntax ||
|
||||
syntax == ldap_jpeg_nonfile_syntax ||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#ifdef LDAP_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#define MODRDNTAG (ldap_compat == 20 ? OLD_LDAP_RES_MODRDN : LDAP_RES_MODRDN)
|
||||
#else
|
||||
#define MODRDNTAG LDAP_RES_MODRDN
|
||||
|
|
@ -45,8 +44,6 @@ do_modrdn(
|
|||
int rc, deleteoldrdn;
|
||||
struct ds_modifyrdn_arg ma;
|
||||
static CommonArgs common = default_common_args;
|
||||
extern DN ldap_str2dn();
|
||||
extern RDN ldap_str2rdn();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -14,21 +14,22 @@ int do_abandon LDAP_P(( struct conn *dsaconn, BerElement *ber, int msgid ));
|
|||
*/
|
||||
|
||||
int do_add LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber ));
|
||||
void add_result LDAP_P(( Sockbuf *sb, struct msg *m ));
|
||||
|
||||
/*
|
||||
* association.c
|
||||
*/
|
||||
|
||||
struct conn *conn_dup LDAP_P(( struct conn *cn ));
|
||||
int conn_init LDAP_P(());
|
||||
int conn_init LDAP_P(( void ));
|
||||
void conn_free LDAP_P(( struct conn *conn ));
|
||||
void conn_del LDAP_P(( struct conn *conn ));
|
||||
void conn_badfds LDAP_P(());
|
||||
void conn_setfds LDAP_P(( fd_set *fds ));
|
||||
void conn_badfds LDAP_P(( void ));
|
||||
struct conn *conn_getfd LDAP_P(( fd_set *fds ));
|
||||
void conn_add LDAP_P(( struct conn *new ));
|
||||
struct conn *conn_find LDAP_P(( struct conn *c ));
|
||||
void conn_add LDAP_P(( struct conn *new ));
|
||||
void conn_close LDAP_P(());
|
||||
void conn_close LDAP_P(( void ));
|
||||
int isclosed LDAP_P(( int ad ));
|
||||
|
||||
/*
|
||||
|
|
@ -46,19 +47,23 @@ int ldap_certif_print LDAP_P(( PS ps, struct certificate *parm, int format ));
|
|||
void ldap_print_algid LDAP_P(( PS ps, struct alg_id *parm, int format ));
|
||||
struct certificate *ldap_str2cert LDAP_P(( char *str ));
|
||||
void ldap_str2alg LDAP_P(( char *str, struct alg_id *alg ));
|
||||
void certif_init LDAP_P(());
|
||||
void certif_init LDAP_P(( void ));
|
||||
|
||||
/*
|
||||
* compare.c
|
||||
*/
|
||||
|
||||
struct ds_compare_result;
|
||||
int do_compare LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber ));
|
||||
void compare_result LDAP_P(( Sockbuf *sb, struct msg *m,
|
||||
struct ds_compare_result *cr ));
|
||||
|
||||
/*
|
||||
* delete.c
|
||||
*/
|
||||
|
||||
int do_delete LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber ));
|
||||
void delete_result LDAP_P(( Sockbuf *sb, struct msg *m ));
|
||||
|
||||
/*
|
||||
* error.c
|
||||
|
|
@ -71,13 +76,17 @@ int x500err2ldaperr LDAP_P(( struct DSError *e, char **matched ));
|
|||
* kerberos.c
|
||||
*/
|
||||
|
||||
struct ds_bind_arg;
|
||||
int kerberosv4_ldap_auth LDAP_P(( char *cred, long len ));
|
||||
int kerberosv4_bindarg LDAP_P(( struct ds_bind_arg *ba, DN dn, char *cred,
|
||||
long len, u_long *nonce ));
|
||||
int kerberos_check_mutual LDAP_P(( struct ds_bind_arg *res, u_long nonce ));
|
||||
|
||||
/*
|
||||
* main.c
|
||||
*/
|
||||
|
||||
void log_and_exit LDAP_P(( int exitcode ));
|
||||
RETSIGTYPE log_and_exit LDAP_P(( int exitcode ));
|
||||
|
||||
/*
|
||||
* message.c
|
||||
|
|
@ -94,9 +103,12 @@ struct msg * get_cldap_msg LDAP_P(( int msgid, int msgtype, struct sockaddr *fro
|
|||
* modify.c
|
||||
*/
|
||||
|
||||
struct ds_read_result;
|
||||
int do_modify LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber ));
|
||||
int do_modify2 LDAP_P((Sockbuf *sb, struct msg *m, struct ds_read_result *rr));
|
||||
Attr_Sequence get_as LDAP_P(( Sockbuf *clientsb, unsigned long op, struct msg *m,
|
||||
char *type, struct berval **bvals ));
|
||||
char *type, struct berval **bvals ));
|
||||
void modify_result LDAP_P(( Sockbuf *sb, struct msg *m ));
|
||||
void modlist_free LDAP_P(( LDAPMod *mods ));
|
||||
|
||||
/*
|
||||
|
|
@ -104,6 +116,7 @@ void modlist_free LDAP_P(( LDAPMod *mods ));
|
|||
*/
|
||||
|
||||
int do_modrdn LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber ));
|
||||
void modrdn_result LDAP_P((Sockbuf *sb, struct msg *m));
|
||||
|
||||
/*
|
||||
* request.c
|
||||
|
|
@ -113,6 +126,10 @@ void client_request LDAP_P(( Sockbuf *clientsb, struct conn *dsaconn, int udp )
|
|||
int do_request LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber,
|
||||
int *bound ));
|
||||
int initiate_dap_operation LDAP_P(( int op, struct msg *m, void *arg ));
|
||||
#ifdef LDAP_DEBUG
|
||||
int trace_ber LDAP_P(( int tag, int len, char *ber,
|
||||
FILE *trace_file, int prepend, int read_pdu ));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* result.c
|
||||
|
|
@ -128,13 +145,17 @@ int send_ldap_result LDAP_P(( Sockbuf *sb, unsigned long tag, int msgid, int err
|
|||
* search.c
|
||||
*/
|
||||
|
||||
struct ds_search_result;
|
||||
int do_search LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber ));
|
||||
void search_result LDAP_P(( Sockbuf *sb, struct msg *m,
|
||||
struct ds_search_result *sr ));
|
||||
|
||||
|
||||
/*
|
||||
* syntax.c
|
||||
*/
|
||||
|
||||
void get_syntaxes LDAP_P(());
|
||||
void get_syntaxes LDAP_P(( void ));
|
||||
int dn_print_real LDAP_P(( PS ps, DN dn, int format));
|
||||
void ldap_dn_print LDAP_P(( PS ps, DN dn, DN base, int format));
|
||||
int encode_dn LDAP_P(( BerElement *ber, DN dn, DN base));
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@
|
|||
#include "ldap.h"
|
||||
#include "common.h"
|
||||
|
||||
extern int dosyslog;
|
||||
|
||||
#ifdef PEPSY_DUMP
|
||||
#ifndef DEBUG
|
||||
#define DEBUG
|
||||
|
|
@ -70,11 +68,6 @@ client_request(
|
|||
BerElement ber, *copyofber;
|
||||
struct msg *m;
|
||||
static int bound;
|
||||
extern char *bound_dn, *bound_pw;
|
||||
struct PSAPaddr *psap_cpy();
|
||||
#ifdef LDAP_COMPAT
|
||||
extern int ldap_compat;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "client_request%s\n",
|
||||
udp ? " udp" : "", 0, 0 );
|
||||
|
|
@ -203,7 +196,7 @@ client_request(
|
|||
* duplicate request: toss this one
|
||||
*/
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"client_request tossing dup request id %d from %s\n",
|
||||
"client_request tossing dup request id %ld from %s\n",
|
||||
msgid, inet_ntoa( ((struct sockaddr_in *)
|
||||
clientsb->sb_fromaddr)->sin_addr ), 0 );
|
||||
free( ber.ber_buf );
|
||||
|
|
|
|||
|
|
@ -27,11 +27,6 @@
|
|||
#include "ldap.h"
|
||||
#include "common.h"
|
||||
|
||||
extern int dosyslog;
|
||||
#ifdef LDAP_COMPAT
|
||||
extern int ldap_compat;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* dsa_response - called by do_queries() when there is activity on one of
|
||||
* the DSA associations. It is passed the association descriptor on which
|
||||
|
|
@ -310,10 +305,6 @@ send_ldap_result(
|
|||
int rc;
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
int cldap;
|
||||
#endif
|
||||
extern int version;
|
||||
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
cldap = ( sb->sb_naddr > 0 );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,11 @@
|
|||
#include "ldap.h"
|
||||
#include "common.h"
|
||||
|
||||
static int get_filter();
|
||||
static int get_filter_list();
|
||||
static int get_substring_filter();
|
||||
static int get_filter( BerElement *ber, Filter *filt );
|
||||
static int get_filter_list( BerElement *ber, Filter f );
|
||||
static int get_substring_filter( BerElement *ber, Filter f );
|
||||
|
||||
#ifdef LDAP_COMPAT
|
||||
extern int version;
|
||||
extern int ldap_compat;
|
||||
#define SEARCHRESTAG (ldap_compat == 20 ? OLD_LDAP_RES_SEARCH_RESULT : LDAP_RES_SEARCH_RESULT)
|
||||
#else
|
||||
#define SEARCHRESTAG LDAP_RES_SEARCH_RESULT
|
||||
|
|
@ -55,7 +53,6 @@ do_search(
|
|||
char **attrs;
|
||||
struct ds_search_arg sa;
|
||||
static CommonArgs common = default_common_args;
|
||||
extern DN ldap_str2dn();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -426,7 +423,6 @@ get_substring_filter( BerElement *ber, Filter f )
|
|||
AttributeType type;
|
||||
char *valstr, *last;
|
||||
AttributeValue value;
|
||||
extern short ldap_dn_syntax;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "get_substring_filter\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include <quipu/ds_search.h>
|
||||
#include <quipu/dap2.h>
|
||||
#include <quipu/dua.h>
|
||||
extern oid_table_attr *name2attr( char * );
|
||||
/*extern AttributeValue str_at2AttrV( char *, IF_AttributeType * );*/
|
||||
|
||||
#include "lber.h"
|
||||
#include "../../libraries/liblber/lber-int.h" /* get struct berelement */
|
||||
|
|
@ -60,7 +62,7 @@ static int syntax_is_string( short syntax );
|
|||
static int
|
||||
get_one_syntax( char *attrib, int required )
|
||||
{
|
||||
oid_table_attr *p, *name2attr();
|
||||
oid_table_attr *p;
|
||||
|
||||
if ( (p = name2attr( attrib )) != (oid_table_attr *) 0 )
|
||||
return( p->oa_syntax );
|
||||
|
|
@ -75,10 +77,8 @@ get_one_syntax( char *attrib, int required )
|
|||
}
|
||||
|
||||
void
|
||||
get_syntaxes()
|
||||
get_syntaxes( void )
|
||||
{
|
||||
oid_table_attr *name2attr();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "get_syntaxes\n", 0, 0, 0 );
|
||||
|
||||
ldap_photo_syntax = get_one_syntax( "photo", 0 );
|
||||
|
|
@ -135,7 +135,8 @@ get_syntaxes()
|
|||
* notation. (e.g., OID.2.6.53).
|
||||
*
|
||||
*/
|
||||
static void attr_key_rfc1779 (
|
||||
static void
|
||||
attr_key_rfc1779(
|
||||
AttributeType at,
|
||||
char *key /* return key, caller allocated */
|
||||
)
|
||||
|
|
@ -182,7 +183,6 @@ dn_print_real(
|
|||
int firstrdn;
|
||||
char *value;
|
||||
PS rps;
|
||||
void ldap_dn_print();
|
||||
char key[512];
|
||||
|
||||
if ( dn == NULLDN )
|
||||
|
|
@ -554,9 +554,6 @@ int
|
|||
encode_attrs( BerElement *ber, Attr_Sequence as )
|
||||
{
|
||||
PS ps;
|
||||
#ifdef LDAP_COMPAT20
|
||||
extern int ldap_compat;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "encode_attrs\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -623,7 +620,8 @@ trim_trailing_spaces( char *s )
|
|||
}
|
||||
}
|
||||
|
||||
DN ldap_str2dn( char *str )
|
||||
DN
|
||||
ldap_str2dn( char *str )
|
||||
{
|
||||
DN dn, save;
|
||||
RDN rdn, newrdn, tmprdn;
|
||||
|
|
@ -786,7 +784,8 @@ DN ldap_str2dn( char *str )
|
|||
#define T61 "{T.61}"
|
||||
#define T61LEN 6
|
||||
|
||||
static void de_t61( char *s, int t61mark )
|
||||
static void
|
||||
de_t61( char *s, int t61mark )
|
||||
{
|
||||
char *next = s;
|
||||
int c, hex;
|
||||
|
|
@ -966,7 +965,6 @@ AttributeValue
|
|||
ldap_str_at2AttrV( char *str, AttributeType type )
|
||||
{
|
||||
char *s, *res, *r;
|
||||
AttributeValue str_at2AttrV();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_str_at2AttrV str (%s) type (%s)\n", str,
|
||||
type->oa_ot.ot_name, 0 );
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ bprint( char *data, int len )
|
|||
out[ i ] = ' ';
|
||||
out[ i+1 ] = *data;
|
||||
} else {
|
||||
out[ i ] = hexdig[ ( *data & 0xf0 ) >> 4 ];
|
||||
out[ i+1 ] = hexdig[ *data & 0x0f ];
|
||||
out[ i ] = hexdig[ ( (unsigned char)*data & 0xf0 ) >> 4 ];
|
||||
out[ i+1 ] = hexdig[ (unsigned char)*data & 0x0f ];
|
||||
}
|
||||
i += 2;
|
||||
len--;
|
||||
|
|
@ -70,7 +70,8 @@ bprint( char *data, int len )
|
|||
}
|
||||
}
|
||||
|
||||
void charlist_free( char **cl )
|
||||
void
|
||||
charlist_free( char **cl )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -86,7 +87,6 @@ int
|
|||
get_ava( BerElement *ber, AVA *tava )
|
||||
{
|
||||
char *type, *value;
|
||||
extern short ldap_dn_syntax;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "get_ava\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -132,7 +132,6 @@ chase_referral(
|
|||
struct access_point *ap;
|
||||
int rc, bound;
|
||||
struct conn *save, *dup, *found;
|
||||
struct PSAPaddr *psap_cpy();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "chase_referral\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,6 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
extern Backend *select_backend();
|
||||
|
||||
extern char *default_referral;
|
||||
|
||||
void
|
||||
do_abandon(
|
||||
Connection *conn,
|
||||
|
|
|
|||
|
|
@ -10,20 +10,9 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
extern Attribute *attr_find();
|
||||
extern struct acl *global_acl;
|
||||
extern int global_default_access;
|
||||
extern char *access2str();
|
||||
extern char *dn_normalize_case();
|
||||
|
||||
int acl_access_allowed();
|
||||
int access_allowed();
|
||||
struct acl *acl_get_applicable();
|
||||
|
||||
static int regex_matches();
|
||||
|
||||
static string_expand(char *newbuf, int bufsiz, char *pattern,
|
||||
char *match, regmatch_t *matches);
|
||||
static int regex_matches(char *pat, char *str, char *buf, regmatch_t *matches);
|
||||
static void string_expand(char *newbuf, int bufsiz, char *pattern,
|
||||
char *match, regmatch_t *matches);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -472,7 +461,8 @@ acl_check_mods(
|
|||
return( LDAP_SUCCESS );
|
||||
}
|
||||
|
||||
static string_expand(
|
||||
static void
|
||||
string_expand(
|
||||
char *newbuf,
|
||||
int bufsiz,
|
||||
char *pat,
|
||||
|
|
|
|||
|
|
@ -12,27 +12,22 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
extern Filter *str2filter();
|
||||
extern struct acl *global_acl;
|
||||
extern char **str2charray();
|
||||
extern char *dn_upcase();
|
||||
|
||||
static void split();
|
||||
static void acl_append();
|
||||
static void access_append();
|
||||
static void acl_usage();
|
||||
static void split(char *line, int splitchar, char **left, char **right);
|
||||
static void acl_append(struct acl **l, struct acl *a);
|
||||
static void access_append(struct access **l, struct access *a);
|
||||
static void acl_usage(void);
|
||||
#ifdef LDAP_DEBUG
|
||||
static void print_acl();
|
||||
static void print_access();
|
||||
static void print_acl(struct acl *a);
|
||||
static void print_access(struct access *b);
|
||||
#endif
|
||||
|
||||
int
|
||||
static int
|
||||
regtest(char *fname, int lineno, char *pat) {
|
||||
int e;
|
||||
regex_t re;
|
||||
|
||||
char buf[512];
|
||||
int size;
|
||||
unsigned size;
|
||||
|
||||
char *sp;
|
||||
char *dp;
|
||||
|
|
@ -369,7 +364,7 @@ str2access( char *str )
|
|||
}
|
||||
|
||||
static void
|
||||
acl_usage()
|
||||
acl_usage( void )
|
||||
{
|
||||
fprintf( stderr, "\n<access clause> ::= access to <what> [ by <who> <access> ]+ \n" );
|
||||
fprintf( stderr, "<what> ::= * | [dn=<regex>] [filter=<ldapfilter>] [attrs=<attrlist>]\n" );
|
||||
|
|
|
|||
|
|
@ -20,20 +20,10 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
extern Backend *select_backend();
|
||||
extern char *dn_normalize();
|
||||
|
||||
extern char *default_referral;
|
||||
extern time_t currenttime;
|
||||
extern pthread_mutex_t currenttime_mutex;
|
||||
extern int global_lastmod;
|
||||
|
||||
static void add_created_attrs();
|
||||
static void add_created_attrs(Operation *op, Entry *e);
|
||||
|
||||
void
|
||||
do_add( conn, op )
|
||||
Connection *conn;
|
||||
Operation *op;
|
||||
do_add( Connection *conn, Operation *op )
|
||||
{
|
||||
BerElement *ber = op->o_ber;
|
||||
char *dn, *last;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
extern char **charray_dup();
|
||||
extern int errno;
|
||||
|
||||
void
|
||||
|
|
@ -294,7 +293,7 @@ attr_syntax_config(
|
|||
} else {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: unknown syntax \"%s\" in attribute line (ignored)\n",
|
||||
fname, lineno, 0 );
|
||||
fname, lineno, argv[lasti] );
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"possible syntaxes are \"cis\", \"ces\", \"tel\", \"dn\", or \"bin\"\n",
|
||||
0, 0, 0 );
|
||||
|
|
@ -325,7 +324,7 @@ attr_syntax_config(
|
|||
|
||||
#ifdef LDAP_DEBUG
|
||||
|
||||
static
|
||||
static int
|
||||
attr_syntax_printnode( struct asyntaxinfo *a )
|
||||
{
|
||||
int i;
|
||||
|
|
@ -337,8 +336,8 @@ attr_syntax_printnode( struct asyntaxinfo *a )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static
|
||||
attr_syntax_print()
|
||||
static void
|
||||
attr_syntax_print( void )
|
||||
{
|
||||
(void) avl_apply( attr_syntaxes, attr_syntax_printnode, 0, -1,
|
||||
AVL_INORDER );
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
#include "portable.h"
|
||||
|
||||
int
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
ldbm_back_abandon()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@
|
|||
#include "back-ldbm.h"
|
||||
#include "proto-back-ldbm.h"
|
||||
|
||||
extern int global_schemacheck;
|
||||
extern char *dn_parent();
|
||||
extern char *dn_normalize();
|
||||
|
||||
int
|
||||
ldbm_back_add(
|
||||
Backend *be,
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
extern char **str2charray();
|
||||
|
||||
static int
|
||||
ainfo_type_cmp(
|
||||
char *type,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
extern char *crypt ();
|
||||
|
||||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
|
@ -23,8 +24,6 @@
|
|||
|
||||
#include <lutil.h>
|
||||
|
||||
extern Attribute *attr_find();
|
||||
|
||||
#ifdef HAVE_KERBEROS
|
||||
extern int krbv4_ldap_auth();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
int strcasecmp( const char *, const char *);
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include "slap.h"
|
||||
|
||||
#include "back-ldbm.h"
|
||||
|
||||
static int cache_delete_entry_internal();
|
||||
static int cache_delete_entry_internal(struct cache *cache, Entry *e);
|
||||
#ifdef LDAP_DEBUG
|
||||
static void lru_print();
|
||||
static void lru_print(struct cache *cache);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -139,7 +140,7 @@ cache_add_entry_lock(
|
|||
cache_entrydn_cmp, avl_dup_error ) != 0 )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"====> cache_add_entry lock: entry %20s id %d already in dn cache\n",
|
||||
"====> cache_add_entry lock: entry %20s id %lu already in dn cache\n",
|
||||
e->e_dn, e->e_id, 0 );
|
||||
|
||||
/* free cache mutex */
|
||||
|
|
@ -152,7 +153,7 @@ cache_add_entry_lock(
|
|||
cache_entryid_cmp, avl_dup_error ) != 0 )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"====> entry %20s id %d already in id cache\n",
|
||||
"====> entry %20s id %lu already in id cache\n",
|
||||
e->e_dn, e->e_id, 0 );
|
||||
|
||||
/* delete from dn tree inserted above */
|
||||
|
|
@ -451,12 +452,12 @@ lru_print( struct cache *cache )
|
|||
|
||||
fprintf( stderr, "LRU queue (head to tail):\n" );
|
||||
for ( e = cache->c_lruhead; e != NULL; e = e->e_lrunext ) {
|
||||
fprintf( stderr, "\tdn %20s id %d refcnt %d\n", e->e_dn,
|
||||
fprintf( stderr, "\tdn %20s id %lu refcnt %d\n", e->e_dn,
|
||||
e->e_id, e->e_refcnt );
|
||||
}
|
||||
fprintf( stderr, "LRU queue (tail to head):\n" );
|
||||
for ( e = cache->c_lrutail; e != NULL; e = e->e_lruprev ) {
|
||||
fprintf( stderr, "\tdn %20s id %d refcnt %d\n", e->e_dn,
|
||||
fprintf( stderr, "\tdn %20s id %lu refcnt %d\n", e->e_dn,
|
||||
e->e_id, e->e_refcnt );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
void
|
||||
ldbm_back_close( Backend *be )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
#include "back-ldbm.h"
|
||||
#include "proto-back-ldbm.h"
|
||||
|
||||
extern Attribute *attr_find();
|
||||
|
||||
int
|
||||
ldbm_back_compare(
|
||||
Backend *be,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
void
|
||||
ldbm_back_config(
|
||||
Backend *be,
|
||||
char *fname,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue