main( int argc, char **argv )
{
- char *ldapfilter, *ldapref;
+ char *ldapfilter;
char *ldapsrcurl, *ldapdesturl;
LDAP *ld;
LDAPMod **mods;
srcldapauthmethod = LDAP_AUTH_KRBV4;
} else {
fprintf( stderr, "%s: unknown auth method\n", optarg );
- fprintf( stderr, "expecting \"simple\" or \"kerberos\"\n",
- optarg );
+ fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
exit( 1 );
}
break;
destldapauthmethod = LDAP_AUTH_KRBV4;
} else {
fprintf( stderr, "%s: unknown auth method\n", optarg );
- fprintf( stderr, "expecting \"simple\" or \"kerberos\"\n",
- optarg );
+ fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
exit( 1 );
}
break;
char *s, *s2;
int i;
- if ( strncmp( ldapsrcurl, "ldap://", 7 ) == 0 ) {
- s = ldapsrcurl + 7;
+ if ( strncmp( ldapsrcurl, "ldap://", 7 ) != 0 ) {
+ fputs( "Not an LDAP URL", stderr ); /* Should be smarter? */
+ return( NULL );
}
+ s = ldapsrcurl + 7;
if ( (s2 = strchr( s, '/' )) == NULL ) {
ldapbase = strdup( s );
} else {
/* first, pick out the destination ldap server info */
if ( ldapbase != NULL ) {
free( ldapbase );
+ ldapbase = NULL;
}
- if ( strncmp( ldapdesturl, "ldap://", 7 ) == 0 ) {
- s = ldapdesturl + 7;
+ if ( strncmp( ldapdesturl, "ldap://", 7 ) != 0 ) {
+ fputs( "Not an LDAP URL", stderr ); /* Should be smarter? */
+ return( NULL );
}
+ s = ldapdesturl + 7;
if ( (s2 = strchr( s, '/' )) == NULL ) {
ldapbase = strdup( s );
} else {