diff options
author | Serge Dussud <Serge.Dussud@Sun.COM> | 2008-10-17 15:26:45 +0100 |
---|---|---|
committer | Serge Dussud <Serge.Dussud@Sun.COM> | 2008-10-17 15:26:45 +0100 |
commit | 924965c71c59efd981e0c32ba257aeb4d9ac51d6 (patch) | |
tree | 673f4dad40df4c9656c46530427940111eb165c3 /usr/src/lib/libldap5/sources/ldap/ber/encode.c | |
parent | 626dff7950e2fd00077128f6e79bacf668f45cf7 (diff) | |
download | illumos-joyent-924965c71c59efd981e0c32ba257aeb4d9ac51d6.tar.gz |
PSARC 2008/607 add O format option to libldap:ber_print
6745345 ber_printf() malforming the octet string refusing the "O" format option
Diffstat (limited to 'usr/src/lib/libldap5/sources/ldap/ber/encode.c')
-rw-r--r-- | usr/src/lib/libldap5/sources/ldap/ber/encode.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/usr/src/lib/libldap5/sources/ldap/ber/encode.c b/usr/src/lib/libldap5/sources/ldap/ber/encode.c index 49481aa70f..25d543f042 100644 --- a/usr/src/lib/libldap5/sources/ldap/ber/encode.c +++ b/usr/src/lib/libldap5/sources/ldap/ber/encode.c @@ -1,10 +1,8 @@ /* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License @@ -565,7 +563,7 @@ ber_printf( BerElement *ber, const char *fmt, ... ) { va_list ap; char *s, **ss; - struct berval **bv; + struct berval *bval, **bv; int rc, i; ber_len_t len; @@ -606,6 +604,17 @@ ber_printf( BerElement *ber, const char *fmt, ... ) rc = ber_put_ostring( ber, s, len, ber->ber_tag ); break; + case 'O': /* berval octet string */ + if( ( bval = va_arg( ap, struct berval * ) ) == NULL ) + break; + if( bval->bv_len == 0 ) { + rc = ber_put_ostring( ber, "", 0, ber->ber_tag ); + } else { + rc = ber_put_ostring( ber, bval->bv_val, bval->bv_len, + ber->ber_tag ); + } + break; + case 's': /* string */ s = va_arg( ap, char * ); rc = ber_put_string( ber, s, ber->ber_tag ); |