connect_to_x500()
{
- if ( (ld = ldap_open( LDAPHOST, LDAP_PORT )) == NULL ) {
+ char *ldaphost;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
+
+ if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
syslog( LOG_ALERT, "ldap_open failed" );
return( -1 );
}
+ free(ldaphost);
ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
ld->ld_deref = LDAP_DEREF_ALWAYS;
#define DEFAULT_SIZELIMIT 50
int debug;
-char *ldaphost = LDAPHOST;
-char *base = DEFAULT_BASE;
+char *ldaphost = NULL;
+char *base = NULL;
int deref;
int sizelimit;
LDAPFiltDesc *filtd;
"facsimileTelephoneNumber", NULL };
extern char *optarg;
extern int optind;
+ FILE *getvar;
+ if((getvar = fopen("/etc/defaultbase.ldap","r"))) {
+ base = malloc(1024);
+ fgets(base, 1024, getvar);
+ if(base[strlen(base) - 1] == '\n')
+ base[strlen(base) - 1] = '\0';
+ fclose(getvar);
+ }
+ if(!base)
+ base = DEFAULT_BASE;
+ if((getvar = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getvar);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getvar);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
deref = LDAP_DEREF_ALWAYS;
while ( (i = getopt( argc, argv, "ab:d:f:x:z:" )) != EOF ) {
#endif /* USE_SYSCONF */
int dosyslog = 1;
-char *ldaphost = LDAPHOST;
+char *ldaphost = NULL;
int ldapport = LDAP_PORT;
char *base = FINGER_BASE;
int deref;
int peernamelen;
int interactive = 0;
extern char *optarg;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
deref = FINGER_DEREF;
while ( (i = getopt( argc, argv, "f:ilp:t:x:p:c:" )) != EOF ) {
int inetd;
int dtblsize;
-char *ldaphost = LDAPHOST;
+char *ldaphost = NULL;
char *base = GO500_BASE;
int rdncount = GO500_RDNCOUNT;
char *filterfile = FILTERFILE;
extern char *optarg;
extern char **Argv;
extern int Argc;
+ FILE *getbase;
/* for setproctitle */
Argv = argv;
Argc = argc;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
while ( (i = getopt( argc, argv, "b:d:f:lp:c:t:x:I" )) != EOF ) {
switch( i ) {
int inetd;
int dtblsize;
-char *ldaphost = LDAPHOST;
+char *ldaphost = NULL;
int ldapport = LDAP_PORT;
int searchaliases = 1;
char *helpfile = GO500GW_HELPFILE;
extern char *optarg;
extern char **Argv;
extern int Argc;
+ FILE *getbase;
+
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
/* for setproctitle */
Argv = argv;
char *errorsfrom = NULL;
char *mailfrom = NULL;
char *host = NULL;
-char *ldaphost = LDAPHOST;
+char *ldaphost = NULL;
int hostlen = 0;
int debug;
FILE *fp;
extern int optind, errno;
extern char *optarg;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
if ( (myname = strrchr( argv[0], '/' )) == NULL )
myname = strdup( argv[0] );
int sizelimit = RCPT500_SIZELIMIT;
int rdncount = RCPT500_RDNCOUNT;
int ldapport = 0;
-char *ldaphost = LDAPHOST;
+char *ldaphost = NULL;
char *searchbase = RCPT500_BASE;
char *dapuser = RCPT500_BINDDN;
char *filterfile = FILTERFILE;
extern int optind;
extern char *optarg;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
*reply = '\0';
#include "ldapconfig.h"
static char *binddn = LDAPDELETE_BINDDN;
-static char *base = LDAPDELETE_BASE;
+static char *base = NULL;
static char *passwd = NULL;
-static char *ldaphost = LDAPHOST;
+static char *ldaphost = NULL;
static int ldapport = LDAP_PORT;
static int not, verbose, contoper;
static LDAP *ld;
extern char *optarg;
extern int optind;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
+ if((getbase = fopen("/etc/defaultbase.ldap","r"))) {
+ base = malloc(1024);
+ fgets(base, 1024, getbase);
+ if(base[strlen(base) - 1] == '\n')
+ base[strlen(base) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!base)
+ base = LDAPDELETE_BASE;
kerberos = not = verbose = contoper = 0;
fp = NULL;
static char *prog;
static char *binddn = LDAPMODIFY_BINDDN;
static char *passwd = NULL;
-static char *ldaphost = LDAPHOST;
+static char *ldaphost = NULL;
static int ldapport = LDAP_PORT;
static int new, replace, not, verbose, contoper, force, valsfromfiles;
static LDAP *ld;
extern char *optarg;
extern int optind;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
if (( prog = strrchr( argv[ 0 ], '/' )) == NULL ) {
prog = argv[ 0 ];
#include "ldapconfig.h"
static char *binddn = LDAPMODRDN_BINDDN;
-static char *base = LDAPMODRDN_BASE;
+static char *base = NULL;
static char *passwd = NULL;
-static char *ldaphost = LDAPHOST;
+static char *ldaphost = NULL;
static int ldapport = LDAP_PORT;
static int not, verbose, contoper;
static LDAP *ld;
extern char *optarg;
extern int optind;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
+
+ if((getbase = fopen("/etc/defaultbase.ldap","r"))) {
+ base = malloc(1024);
+ fgets(base, 1024, getbase);
+ if(base[strlen(base) - 1] == '\n')
+ base[strlen(base) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!base)
+ base = LDAPMODRDN_BASE;
infile = NULL;
kerberos = not = contoper = verbose = remove = 0;
static char *binddn = LDAPSEARCH_BINDDN;
static char *passwd = NULL;
-static char *base = LDAPSEARCH_BASE;
-static char *ldaphost = LDAPHOST;
+static char *base = NULL;
+static char *ldaphost = NULL;
static int ldapport = LDAP_PORT;
static char *sep = DEFSEP;
static char *sortattr = NULL;
LDAP *ld;
extern char *optarg;
extern int optind;
+ FILE *getbase;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
+ ldaphost = LDAPHOST;
+ if((getbase = fopen("/etc/defaultbase.ldap","r"))) {
+ base = malloc(1024);
+ fgets(base, 1024, getbase);
+ if(base[strlen(base) - 1] == '\n')
+ base[strlen(base) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!base)
+ base = LDAPSEARCH_BASE;
infile = NULL;
deref = verbose = allow_binary = not = kerberos = vals2tmp =
extern SIG_FN attn(); /* ^C signal handler */
extern char *getenv();
extern void Free();
+ FILE *getbase;
#ifdef DEBUG
if (debug & D_TRACE)
group_base = strdup(UD_WHERE_GROUPS_ARE_CREATED);
if (search_base == NULL)
search_base = strdup(UD_BASE);
- if (server == NULL)
+
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ server = malloc(1024);
+ fgets(server, 1024, getbase);
+ if(server[strlen(server) - 1] == '\n')
+ server[strlen(server) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!server)
server = strdup(LDAPHOST);
/*
char *srcldappasswd;
char *destldapbinddn;
char *destldappasswd;
-char *ldapbase;
+char *ldapbase = NULL;
int srcldapauthmethod;
int destldapauthmethod;
int verbose;
char *s;
extern int optind;
extern char *optarg;
+ FILE *getbase;
ldapsrcurl = NULL;
ldapdesturl = NULL;
+ if((getbase = fopen("/etc/ldapserver","r"))) {
+ ldaphost = malloc(1024);
+ fgets(ldaphost, 1024, getbase);
+ if(ldaphost[strlen(ldaphost) - 1] == '\n')
+ ldaphost[strlen(ldaphost) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldaphost)
ldaphost = LDAPHOST;
+ if((getbase = fopen("/etc/defaultbase.ldap","r"))) {
+ ldapbase = malloc(1024);
+ fgets(ldapbase, 1024, getbase);
+ if(ldapbase[strlen(ldapbase) - 1] == '\n')
+ ldapbase[strlen(ldapbase) - 1] = '\0';
+ fclose(getbase);
+ }
+ if(!ldapbase)
ldapbase = DEFAULT_BASE;
+
srcldapauthmethod = LDAP_AUTH_SIMPLE;
destldapauthmethod = LDAP_AUTH_SIMPLE;
srcldapbinddn = NULL;