diff options
author | Günther Deschner <gd@samba.org> | 2008-01-18 01:56:01 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-01-18 02:54:29 +0100 |
commit | c2ff6c94f2f9ddc2c4b03f7907f7d6e0de951c24 (patch) | |
tree | 619b6484e3b7c114ccd58db21ff68ec7587933d8 | |
parent | 80d7cccfe7d6179da75c00481f2116dae6755682 (diff) | |
download | samba-c2ff6c94f2f9ddc2c4b03f7907f7d6e0de951c24.tar.gz samba-c2ff6c94f2f9ddc2c4b03f7907f7d6e0de951c24.tar.bz2 samba-c2ff6c94f2f9ddc2c4b03f7907f7d6e0de951c24.zip |
Improve libnetapi_set_error_string().
Guenther
(This used to be commit 96f645553ae5c75aabfe588e1a67f3d4bfacb5cb)
-rw-r--r-- | source3/lib/netapi/netapi.c | 11 | ||||
-rw-r--r-- | source3/lib/netapi/netapi.h | 35 |
2 files changed, 39 insertions, 7 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index ce00054e6e..5c3f7ec465 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -205,15 +205,20 @@ const char *libnetapi_errstr(NET_API_STATUS status) ****************************************************************/ NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, - const char *error_string) + const char *format, ...) { + va_list args; + TALLOC_FREE(ctx->error_string); - ctx->error_string = talloc_strdup(ctx, error_string); + + va_start(args, format); + ctx->error_string = talloc_vasprintf(ctx, format, args); + va_end(args); + if (!ctx->error_string) { return W_ERROR_V(WERR_NOMEM); } return NET_API_STATUS_SUCCESS; - } /**************************************************************** diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 274a167d53..67bb8a8fca 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -57,46 +57,73 @@ NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *use NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); const char *libnetapi_errstr(NET_API_STATUS status); -NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string); +NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...); const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status); /**************************************************************** + NetApiBufferFree ****************************************************************/ NET_API_STATUS NetApiBufferFree(void *buffer); /**************************************************************** + NetJoinDomain ****************************************************************/ -/* wkssvc */ NET_API_STATUS NetJoinDomain(const char *server, const char *domain, const char *account_ou, const char *account, const char *password, uint32_t join_options); + +/**************************************************************** + NetUnjoinDomain +****************************************************************/ + NET_API_STATUS NetUnjoinDomain(const char *server_name, const char *account, const char *password, uint32_t unjoin_flags); + +/**************************************************************** + NetGetJoinInformation +****************************************************************/ + NET_API_STATUS NetGetJoinInformation(const char *server_name, const char **name_buffer, uint16_t *name_type); -/* srvsvc */ +/**************************************************************** + NetServerGetInfo +****************************************************************/ + NET_API_STATUS NetServerGetInfo(const char *server_name, uint32_t level, uint8_t **buffer); + +/**************************************************************** + NetServerSetInfo +****************************************************************/ + NET_API_STATUS NetServerSetInfo(const char *server_name, uint32_t level, uint8_t *buffer, uint32_t *parm_error); -/* netlogon */ +/**************************************************************** + NetGetDCName +****************************************************************/ + NET_API_STATUS NetGetDCName(const char *server_name, const char *domain_name, uint8_t **buffer); + +/**************************************************************** + NetGetAnyDCName +****************************************************************/ + NET_API_STATUS NetGetAnyDCName(const char *server_name, const char *domain_name, uint8_t **buffer); |