Commit ec9af18e authored by Alexandre Julliard's avatar Alexandre Julliard

wldap32: Added a wrapper for ber_scanf.

parent 7a1fb2ec
......@@ -248,11 +248,86 @@ INT WLDAP32_ber_printf( BerElement *berelement, PCHAR fmt, ... )
}
#ifndef HAVE_LDAP
INT ber_scanf( BerElement *berelement, PCHAR fmt, ... )
/***********************************************************************
* ber_scanf (WLDAP32.@)
*/
INT WLDAP32_ber_scanf( BerElement *berelement, PCHAR fmt, ... )
{
#ifdef HAVE_LDAP
va_list list;
int ret = 0;
char new_fmt[2];
new_fmt[1] = 0;
va_start( list, fmt );
while (*fmt)
{
new_fmt[0] = *fmt++;
switch(new_fmt[0])
{
case 'a':
{
char **ptr = va_arg( list, char ** );
ret = ber_scanf( berelement, new_fmt, ptr );
break;
}
case 'b':
case 'e':
case 'i':
{
int *i = va_arg( list, int * );
ret = ber_scanf( berelement, new_fmt, i );
break;
}
case 't':
{
unsigned int *tag = va_arg( list, unsigned int * );
ret = ber_scanf( berelement, new_fmt, tag );
break;
}
case 'v':
{
char ***array = va_arg( list, char *** );
ret = ber_scanf( berelement, new_fmt, array );
break;
}
case 'B':
{
char **str = va_arg( list, char ** );
int *len = va_arg( list, int * );
ret = ber_scanf( berelement, new_fmt, str, len );
break;
}
case 'O':
{
struct berval **ptr = va_arg( list, struct berval ** );
ret = ber_scanf( berelement, new_fmt, ptr );
break;
}
case 'V':
{
struct berval ***array = va_arg( list, struct berval *** );
ret = ber_scanf( berelement, new_fmt, array );
break;
}
case 'n':
case 'x':
case '{':
case '}':
case '[':
case ']':
ret = ber_scanf( berelement, new_fmt );
break;
default:
FIXME( "Unknown format '%c'\n", new_fmt[0] );
ret = -1;
break;
}
if (ret == -1) break;
}
va_end( list );
return ret;
#else
return LBER_ERROR;
#endif
}
#endif /* HAVE_LDAP */
......@@ -226,7 +226,7 @@
308 cdecl ber_next_element(ptr ptr ptr) WLDAP32_ber_next_element
309 cdecl ber_flatten(ptr ptr) WLDAP32_ber_flatten
310 varargs ber_printf(ptr str) WLDAP32_ber_printf
311 varargs ber_scanf(ptr str)
311 varargs ber_scanf(ptr str) WLDAP32_ber_scanf
312 cdecl ldap_conn_from_msg(ptr ptr)
313 cdecl ldap_sasl_bindW(ptr wstr wstr ptr ptr ptr ptr)
314 cdecl ldap_sasl_bind_sW(ptr wstr wstr ptr ptr ptr ptr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment