ber_bvdup LDAP_P((
LDAP_CONST struct berval *bv ));
+LIBLBER_F( struct berval * )
+ber_bvstr LDAP_P((
+ LDAP_CONST char * ));
+
+LIBLBER_F( struct berval * )
+ber_bvstrdup LDAP_P((
+ LDAP_CONST char * ));
+
LIBLBER_F( char * )
ber_strdup LDAP_P((
LDAP_CONST char * ));
# define LIBLUTIL_F(type) extern type
#endif
-/* SLAPD (as a module exporting symbols */
+/* SLAPD (as a module exporting symbols) */
#if defined(LIBSLAPD_DECL) && defined(_WIN32)
# define LIBSLAPD_F(type) extern __declspec(LIBSLAPD_DECL) type
#else
return( new );
}
+struct berval *
+ber_bvstr(
+ LDAP_CONST char *s )
+{
+ struct berval *new;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( s == NULL ) {
+ ber_errno = LBER_ERROR_PARAM;
+ return NULL;
+ }
+
+ if(( new = LBER_MALLOC( sizeof(struct berval) )) == NULL ) {
+ ber_errno = LBER_ERROR_MEMORY;
+ return NULL;
+ }
+
+ if ( *s == '\0' ) {
+ new->bv_val = NULL;
+ new->bv_len = 0;
+ return new;
+ }
+
+ new->bv_val = (char *) s;
+ new->bv_len = strlen( s );
+
+ return( new );
+}
+
+struct berval *
+ber_bvstrdup(
+ LDAP_CONST char *s )
+{
+ struct berval *new;
+ char *p;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( s == NULL ) {
+ ber_errno = LBER_ERROR_PARAM;
+ return NULL;
+ }
+
+ p = LBER_STRDUP( s );
+
+ if( p == NULL ) {
+ ber_errno = LBER_ERROR_MEMORY;
+ return NULL;
+ }
+
+ new = ber_bvstr( p );
+
+ if( new == NULL || *p == '\0' ) {
+ LBER_FREE( p );
+ }
+
+ return( new );
+}
+
char *
ber_strdup( LDAP_CONST char *s )
{