+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 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)
* Other attributes may not.
*/
count = 1;
- (void) memset(buffer, 0, sizeof(buffer));
+ (void) memset(buffer, '\0', sizeof(buffer));
#ifdef UOFM
if (!strcmp(id, "postalAddress") || !strcmp(id, "homePostalAddress") || !strcmp(id, "multiLineDescription") || !strcmp(id, "vacationMessage"))
#else
}
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;
printf(" Please enter Y for yes, N for no, or RETURN to cancel: ");
fflush(stdout);
(void) fetch_buffer(response, sizeof(response), stdin);
- for (s = response; isspace(*s); s++)
+ for (s = response; isspace((unsigned char)*s); s++)
;
if ((*s == 'y') || (*s == 'Y')) {
if (ldap_modify_s(ld, who, mods)) {
printf("\n Change this setting [no]? ");
fflush(stdout);
(void) fetch_buffer(response, sizeof(response), stdin);
- for (s = response; isspace(*s); s++)
+ for (s = response; isspace((unsigned char)*s); s++)
;
if ((*s == 'y') || (*s == 'Y')) {
if (!strcmp(cp, "TRUE"))
register char *cp;
for (cp = url; *cp != '\n' && *cp != '\0'; cp++) {
- if (isspace(*cp))
+ if (isspace((unsigned char)*cp))
return(-1);
/*NOTREACHED*/
}
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" );
}