diff options
author | Jeremy Allison <jra@samba.org> | 1998-04-23 20:12:17 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-04-23 20:12:17 +0000 |
commit | 002a47de8e0cf03c79cedbed2db52f391001f459 (patch) | |
tree | 1a23fd1edab2979024d5212f64cdc031d309f481 /source3/libsmb | |
parent | a85f5bc268a1c13334b86ac3a44a026359c09371 (diff) | |
download | samba-002a47de8e0cf03c79cedbed2db52f391001f459.tar.gz samba-002a47de8e0cf03c79cedbed2db52f391001f459.tar.bz2 samba-002a47de8e0cf03c79cedbed2db52f391001f459.zip |
clientgen.c: Added rap error codes to cli_error, moved from smbpasswd.c
password.c: Changed global cli -> pw_cli, removed strtok (bad strtok, bad :-)
use in security=server, started to extend security=domain code.
smbpasswd.c: Removed rap error code functions.
Jeremy.
(This used to be commit 0f00b8fce1a5cad7f8c212568fa33f09986e5bd6)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clientgen.c | 71 |
1 files changed, 63 insertions, 8 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index ea51395a8f..9de6afccee 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -29,6 +29,69 @@ extern int DEBUGLEVEL; +/***************************************************** + RAP error codes - a small start but will be extended. +*******************************************************/ + +struct +{ + int err; + char *message; +} rap_errmap[] = +{ + {5, "User has insufficient privilege" }, + {86, "The specified password is invalid" }, + {2226, "Operation only permitted on a Primary Domain Controller" }, + {2242, "The password of this user has expired." }, + {2243, "The password of this user cannot change." }, + {2244, "This password cannot be used now (password history conflict)." }, + {2245, "The password is shorter than required." }, + {2246, "The password of this user is too recent to change."}, + {0, NULL} +}; + +/**************************************************************************** + return a description of an SMB error +****************************************************************************/ +char *cli_smb_errstr(struct cli_state *cli) +{ + return smb_errstr(cli->inbuf); +} + +/****************************************************** + Return an error message - either an SMB error or a RAP + error. +*******************************************************/ + +char *cli_errstr(struct cli_state *cli) +{ + static fstring error_message; + int errclass; + int errnum; + int i; + + /* + * Errors are of two kinds - smb errors, + * dealt with by cli_smb_errstr, and rap + * errors, whose error code is in cli.error. + */ + + cli_error(cli, &errclass, &errnum); + if(errclass != 0) + return cli_smb_errstr(cli); + + sprintf(error_message, "code %d", cli->error); + + for(i = 0; rap_errmap[i].message != NULL; i++) { + if (rap_errmap[i].err == cli->error) { + fstrcpy( error_message, rap_errmap[i].message); + break; + } + } + + return error_message; +} + /**************************************************************************** setup basics in a outgoing packet ****************************************************************************/ @@ -1567,14 +1630,6 @@ void cli_shutdown(struct cli_state *cli) } /**************************************************************************** - return a description of the error -****************************************************************************/ -char *cli_errstr(struct cli_state *cli) -{ - return smb_errstr(cli->inbuf); -} - -/**************************************************************************** return error codes for the last packet ****************************************************************************/ void cli_error(struct cli_state *cli, int *eclass, int *num) |