1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-19 12:23:49 +03:00

Refactor libnetapi error string functions a bit.

Guenther
This commit is contained in:
Günther Deschner
2008-01-11 14:47:23 +01:00
parent 2e2d058b7e
commit 3b450a8bcc
2 changed files with 20 additions and 6 deletions

View File

@@ -192,8 +192,7 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
/****************************************************************
****************************************************************/
const char *libnetapi_errstr(struct libnetapi_ctx *ctx,
NET_API_STATUS status)
const char *libnetapi_errstr(NET_API_STATUS status)
{
if (status & 0xc0000000) {
return get_friendly_nt_error_msg(NT_STATUS(status));
@@ -220,9 +219,23 @@ NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx,
/****************************************************************
****************************************************************/
const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx)
const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
NET_API_STATUS status)
{
return ctx->error_string;
struct libnetapi_ctx *tmp_ctx = ctx;
if (!tmp_ctx) {
status = libnetapi_getctx(&tmp_ctx);
if (status != 0) {
return NULL;
}
}
if (tmp_ctx->error_string) {
return tmp_ctx->error_string;
}
return libnetapi_errstr(status);
}
/****************************************************************