Commit 25c70891 authored by Alexandre Julliard's avatar Alexandre Julliard

wldap32: Map Unix error codes to Windows ones for all functions.

parent 316f3fc6
......@@ -244,8 +244,8 @@ ULONG CDECL ldap_add_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
if (!clientctrlsU) goto exit;
}
ret = ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy );
ret = map_error( ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy ));
exit:
strfreeU( dnU );
......@@ -361,8 +361,8 @@ ULONG CDECL ldap_add_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
if (!clientctrlsU) goto exit;
}
ret = ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs,
serverctrlsU, clientctrlsU );
ret = map_error( ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs,
serverctrlsU, clientctrlsU ));
exit:
strfreeU( dnU );
......@@ -448,7 +448,7 @@ ULONG CDECL ldap_add_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
if (!attrsU) goto exit;
}
ret = ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL );
ret = map_error( ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL ));
exit:
strfreeU( dnU );
......
......@@ -211,7 +211,7 @@ ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method
pwd.bv_val = credU;
}
ret = ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL );
ret = map_error( ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
exit:
strfreeU( dnU );
......@@ -328,8 +328,8 @@ ULONG CDECL ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn,
credU.bv_len = cred->bv_len;
credU.bv_val = cred->bv_val;
ret = ldap_sasl_bind( ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, message );
ret = map_error( ldap_sasl_bind( ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, message ));
exit:
strfreeU( dnU );
......@@ -448,8 +448,8 @@ ULONG CDECL ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn,
credU.bv_len = cred->bv_len;
credU.bv_val = cred->bv_val;
ret = ldap_sasl_bind_s( ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, (struct berval **)serverdata );
ret = map_error( ldap_sasl_bind_s( ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, (struct berval **)serverdata ));
exit:
strfreeU( dnU );
......@@ -633,7 +633,7 @@ ULONG CDECL ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
pwd.bv_val = passwdU;
}
ret = ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL );
ret = map_error( ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
exit:
strfreeU( dnU );
......@@ -663,7 +663,7 @@ ULONG CDECL WLDAP32_ldap_unbind( WLDAP32_LDAP *ld )
TRACE( "(%p)\n", ld );
if (ld)
ret = ldap_unbind_ext( ld, NULL, NULL );
ret = map_error( ldap_unbind_ext( ld, NULL, NULL ));
else
ret = WLDAP32_LDAP_PARAM_ERROR;
......@@ -691,7 +691,7 @@ ULONG CDECL WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld )
TRACE( "(%p)\n", ld );
if (ld)
ret = ldap_unbind_ext_s( ld, NULL, NULL );
ret = map_error( ldap_unbind_ext_s( ld, NULL, NULL ));
else
ret = WLDAP32_LDAP_PARAM_ERROR;
......
......@@ -268,8 +268,8 @@ ULONG CDECL ldap_compare_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR
if (!clientctrlsU) goto exit;
}
ret = ldap_compare_ext( ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU, (int *)message );
ret = map_error( ldap_compare_ext( ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU, (int *)message ));
exit:
strfreeU( dnU );
......@@ -404,9 +404,9 @@ ULONG CDECL ldap_compare_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHA
if (!clientctrlsU) goto exit;
}
ret = ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "",
data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU );
ret = map_error( ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "",
data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU ));
exit:
strfreeU( dnU );
......@@ -506,7 +506,7 @@ ULONG CDECL ldap_compare_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR va
val.bv_val = valueU;
}
ret = ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "", &val, NULL, NULL );
ret = map_error( ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "", &val, NULL, NULL ));
exit:
strfreeU( dnU );
......
......@@ -189,7 +189,7 @@ ULONG CDECL ldap_create_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey,
sortkeyU = sortkeyarrayWtoU( sortkey );
if (!sortkeyU) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_create_sort_control( ld, sortkeyU, critical, &controlU );
ret = map_error( ldap_create_sort_control( ld, sortkeyU, critical, &controlU ));
*control = controlUtoW( controlU );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
......@@ -263,9 +263,9 @@ INT CDECL ldap_create_vlv_controlW( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info,
if (!ld || !control) return ~0UL;
ret = ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU );
ret = map_error( ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU ));
if (ret == LDAP_SUCCESS)
if (ret == WLDAP32_LDAP_SUCCESS)
{
*control = controlUtoW( controlU );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
......
......@@ -206,8 +206,8 @@ ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *server
if (!clientctrlsU) goto exit;
}
ret = ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
message ? (int *)message : &dummy );
ret = map_error( ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
message ? (int *)message : &dummy ));
exit:
strfreeU( dnU );
......@@ -305,7 +305,7 @@ ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serv
if (!clientctrlsU) goto exit;
}
ret = ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU );
ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU ));
exit:
strfreeU( dnU );
......@@ -371,7 +371,7 @@ ULONG CDECL ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL );
ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL ));
strfreeU( dnU );
#endif
......
......@@ -160,8 +160,8 @@ ULONG CDECL ldap_extended_operationW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLDAP
if (!clientctrlsU) goto exit;
}
ret = ldap_extended_operation( ld, oid ? oidU : "", (struct berval *)data,
serverctrlsU, clientctrlsU, (int *)message );
ret = map_error( ldap_extended_operation( ld, oid ? oidU : "", (struct berval *)data,
serverctrlsU, clientctrlsU, (int *)message ));
exit:
strfreeU( oidU );
......@@ -277,8 +277,8 @@ ULONG CDECL ldap_extended_operation_sW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLD
if (!clientctrlsU) goto exit;
}
ret = ldap_extended_operation_s( ld, oid ? oidU : "", (struct berval *)data, serverctrlsU,
clientctrlsU, &retoidU, (struct berval **)retdata );
ret = map_error( ldap_extended_operation_s( ld, oid ? oidU : "", (struct berval *)data, serverctrlsU,
clientctrlsU, &retoidU, (struct berval **)retdata ));
if (retoid && retoidU) {
*retoid = strUtoW( retoidU );
......
......@@ -646,7 +646,7 @@ ULONG CDECL ldap_start_tls_sW( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMess
if (!clientctrlsU) goto exit;
}
ret = ldap_start_tls_s( ld, serverctrlsU, clientctrlsU );
ret = map_error( ldap_start_tls_s( ld, serverctrlsU, clientctrlsU ));
exit:
controlarrayfreeU( serverctrlsU );
......
......@@ -60,7 +60,7 @@ ULONG CDECL WLDAP32_ldap_abandon( WLDAP32_LDAP *ld, ULONG msgid )
TRACE( "(%p, 0x%08x)\n", ld, msgid );
if (!ld) return ~0UL;
ret = ldap_abandon_ext( ld, msgid, NULL, NULL );
ret = map_error( ldap_abandon_ext( ld, msgid, NULL, NULL ));
#endif
return ret;
......
......@@ -245,8 +245,8 @@ ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
if (!clientctrlsU) goto exit;
}
ret = ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy );
ret = map_error( ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy ));
exit:
strfreeU( dnU );
......@@ -362,8 +362,8 @@ ULONG CDECL ldap_modify_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
if (!clientctrlsU) goto exit;
}
ret = ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods,
serverctrlsU, clientctrlsU );
ret = map_error( ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods,
serverctrlsU, clientctrlsU ));
exit:
strfreeU( dnU );
......@@ -449,7 +449,7 @@ ULONG CDECL ldap_modify_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
if (!modsU) goto exit;
}
ret = ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods, NULL, NULL );
ret = map_error( ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods, NULL, NULL ));
exit:
strfreeU( dnU );
......
......@@ -289,7 +289,7 @@ ULONG CDECL ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT dele
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
ret = ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL );
ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL ));
exit:
strfreeU( dnU );
......@@ -368,7 +368,7 @@ ULONG CDECL ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
ret = ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL );
ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL ));
exit:
strfreeU( dnU );
......
......@@ -206,7 +206,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
if (!featureU.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_get_option( ld, option, &featureU );
ret = map_error( ldap_get_option( ld, option, &featureU ));
featureW->ldapaif_version = featureU.ldapaif_version;
strfreeU( featureU.ldapaif_name );
......@@ -220,7 +220,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
memset( &infoU, 0, sizeof(LDAPAPIInfo) );
infoU.ldapai_info_version = infoW->ldapai_info_version;
ret = ldap_get_option( ld, option, &infoU );
ret = map_error( ldap_get_option( ld, option, &infoU ));
infoW->ldapai_api_version = infoU.ldapai_api_version;
infoW->ldapai_protocol_version = infoU.ldapai_protocol_version;
......@@ -253,7 +253,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
return ldap_get_option( ld, option, value );
return map_error( ldap_get_option( ld, option, value ));
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
......@@ -433,7 +433,7 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
ctrlsU = controlarrayWtoU( (LDAPControlW **)value );
if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_set_option( ld, option, ctrlsU );
ret = map_error( ldap_set_option( ld, option, ctrlsU ));
controlarrayfreeU( ctrlsU );
return ret;
}
......@@ -444,7 +444,7 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
return ldap_set_option( ld, option, value );
return map_error( ldap_set_option( ld, option, value ));
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
......
......@@ -99,7 +99,7 @@ ULONG CDECL ldap_parse_extended_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
ret = ldap_parse_extended_result( ld, result, &oidU, (struct berval **)data, free );
ret = map_error( ldap_parse_extended_result( ld, result, &oidU, (struct berval **)data, free ) );
if (oid) {
*oid = strUtoW( oidU );
......@@ -164,7 +164,7 @@ ULONG CDECL ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *messag
if (!ld) return ~0UL;
ret = ldap_parse_reference( ld, message, &referralsU, NULL, 0 );
ret = map_error( ldap_parse_reference( ld, message, &referralsU, NULL, 0 ));
*referrals = strarrayUtoW( referralsU );
ldap_memfree( referralsU );
......@@ -249,8 +249,8 @@ ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
ret = ldap_parse_result( ld, result, (int *)retcode, &matchedU, &errorU,
&referralsU, &serverctrlsU, free );
ret = map_error( ldap_parse_result( ld, result, (int *)retcode, &matchedU, &errorU,
&referralsU, &serverctrlsU, free ));
if (matched) *matched = strUtoW( matchedU );
if (error) *error = strUtoW( errorU );
......@@ -264,7 +264,7 @@ ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
ldap_controls_free( serverctrlsU );
#endif
return map_error( ret );
return ret;
}
/***********************************************************************
......@@ -470,5 +470,5 @@ INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
controlarrayfreeU( controlU );
#endif
return ret;
return map_error( ret );
}
......@@ -157,8 +157,8 @@ ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
if (!clientctrlsU) goto exit;
}
ret = ldap_rename( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU, (int *)message );
ret = map_error( ldap_rename( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU, (int *)message ));
exit:
strfreeU( dnU );
......@@ -283,8 +283,8 @@ ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
if (!clientctrlsU) goto exit;
}
ret = ldap_rename_s( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU );
ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU ));
exit:
strfreeU( dnU );
......
......@@ -277,8 +277,8 @@ ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
tv.tv_sec = timelimit;
tv.tv_usec = 0;
ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, &tv, sizelimit, (int *)message );
ret = map_error( ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, &tv, sizelimit, (int *)message ));
exit:
strfreeU( baseU );
......@@ -412,8 +412,9 @@ ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
if (!clientctrlsU) goto exit;
}
ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, (struct timeval *)timeout, sizelimit, res );
ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, (struct timeval *)timeout,
sizelimit, res ));
exit:
strfreeU( baseU );
......@@ -518,8 +519,8 @@ ULONG CDECL ldap_search_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR f
if (!attrsU) goto exit;
}
ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, NULL, 0, res );
ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, NULL, 0, res ));
exit:
strfreeU( baseU );
......@@ -628,8 +629,8 @@ ULONG CDECL ldap_search_stW( WLDAP32_LDAP *ld, const PWCHAR base, ULONG scope,
if (!attrsU) goto exit;
}
ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, (struct timeval *)timeout, 0, res );
ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, (struct timeval *)timeout, 0, res ));
exit:
strfreeU( baseU );
......
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