+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Copyright (c) 1991,1993 Regents of the University of Michigan.
* All rights reserved.
#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/string.h>
parse_answer(mp);
(void) ldap_msgfree(mp);
}
- (void) Free(dn);
+ ldap_memfree(dn);
ldap_value_free(rdns);
return;
}
int count; /* line # of new value -- if multiline */
int multiline = 0; /* 1 if this value is multiline */
static char line[LINE_SIZE]; /* raw line from user */
- static char buffer[MAX_DESC_LINES * LINE_SIZE]; /* holds ALL of the
+ static char buffer[MAX_DESC_LINES * (LINE_SIZE+2)]; /* holds ALL of the
lines we get */
#ifdef DEBUG
if (debug & D_TRACE)
}
tmp = ldap_get_dn(ld, elmp);
strcpy(buffer, tmp);
- Free(tmp);
+ ldap_memfree(tmp);
(void) ldap_msgfree(lmp);
break;
}
* are done.
*/
if (count++ > 1)
- (void) strcat(buffer, "$");
+ (void) strcat(buffer, " $ ");
(void) strcat(buffer, line);
if (!multiline)
break;
void
mod_perror( LDAP *ld )
{
- int ld_errno = 0;
+ int ld_errno = LDAP_SUCCESS;
+ char *ld_errtext = NULL;
- if(ld != NULL) {
- ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
- }
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno );
- if (( ld == NULL ) || ( ld_errno != LDAP_UNAVAILABLE &&
- ld_errno != LDAP_UNWILLING_TO_PERFORM ))
- {
- ldap_perror( ld, "modify" );
- return;
- }
+ if( ld_errno != LDAP_SUCCESS ) {
+ ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ld_errtext );
+ }
- fprintf( stderr, "\n modify: failed because part of the online directory is not able\n" );
- fprintf( stderr, " to be modified right now" );
- if ( ld_errno == LDAP_UNAVAILABLE ) {
- fprintf( stderr, " or is temporarily unavailable" );
+ fprintf( stderr, " modify failed: %s (%d)\n",
+ ldap_err2string( ld_errno ), ld_errno );
+
+ if( ld_errtext != NULL ) {
+ fprintf( stderr, " additional information: %s\n",
+ ld_errtext );
}
- fprintf( stderr, ".\n Please try again later.\n" );
+
+ fprintf( stderr, " Please try again later.\n" );
}