diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-08-27 19:46:22 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-08-27 19:46:22 +0000 |
commit | b031af348c7dcc8c74bf49945211c466b8eca079 (patch) | |
tree | c6a20abba3c8432ad2980beeab9e1d2a8528f3a4 /source3/smbd | |
parent | 1d726fe0e054be9017309186c24b24d032e85636 (diff) | |
download | samba-b031af348c7dcc8c74bf49945211c466b8eca079.tar.gz samba-b031af348c7dcc8c74bf49945211c466b8eca079.tar.bz2 samba-b031af348c7dcc8c74bf49945211c466b8eca079.zip |
converted another bunch of stuff to NTSTATUS
(This used to be commit 1d36250e338ae0ff9fbbf86019809205dd97d05e)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/auth.c | 16 | ||||
-rw-r--r-- | source3/smbd/auth_rhosts.c | 2 | ||||
-rw-r--r-- | source3/smbd/auth_server.c | 2 | ||||
-rw-r--r-- | source3/smbd/auth_smbpasswd.c | 8 | ||||
-rw-r--r-- | source3/smbd/auth_unix.c | 2 | ||||
-rw-r--r-- | source3/smbd/auth_util.c | 2 | ||||
-rw-r--r-- | source3/smbd/error.c | 4 | ||||
-rw-r--r-- | source3/smbd/service.c | 44 |
8 files changed, 40 insertions, 40 deletions
diff --git a/source3/smbd/auth.c b/source3/smbd/auth.c index ec493b7c06..d6bc8aeadc 100644 --- a/source3/smbd/auth.c +++ b/source3/smbd/auth.c @@ -68,15 +68,15 @@ NTSTATUS check_password(const auth_usersupplied_info *user_info, return NT_STATUS_LOGON_FAILURE; } - if (nt_status != NT_STATUS_NOPROBLEMO) { + if (nt_status != NT_STATUS_OK) { nt_status = check_rhosts_security(user_info, server_info); } - if ((lp_security() == SEC_DOMAIN) && (nt_status != NT_STATUS_NOPROBLEMO)) { + if ((lp_security() == SEC_DOMAIN) && (nt_status != NT_STATUS_OK)) { nt_status = check_domain_security(user_info, server_info); } - if ((lp_security() == SEC_SERVER) && (nt_status != NT_STATUS_NOPROBLEMO)) { + if ((lp_security() == SEC_SERVER) && (nt_status != NT_STATUS_OK)) { nt_status = check_server_security(user_info, server_info); } @@ -84,7 +84,7 @@ NTSTATUS check_password(const auth_usersupplied_info *user_info, smb_user_control(user_info->smb_username.str, nt_status); } - if (nt_status != NT_STATUS_NOPROBLEMO) { + if (nt_status != NT_STATUS_OK) { if ((user_info->plaintext_password.len > 0) && (!lp_plaintext_to_smbpasswd())) { nt_status = check_unix_security(user_info, server_info); @@ -94,14 +94,14 @@ NTSTATUS check_password(const auth_usersupplied_info *user_info, } } - if ((nt_status == NT_STATUS_NOPROBLEMO) && !done_pam) { + if ((nt_status == NT_STATUS_OK) && !done_pam) { /* We might not be root if we are an RPC call */ become_root(); nt_status = smb_pam_accountcheck(user_info->smb_username.str); unbecome_root(); } - if (nt_status == NT_STATUS_NOPROBLEMO) { + if (nt_status == NT_STATUS_OK) { DEBUG(5, ("check_password: Password for user %s suceeded\n", user_info->smb_username.str)); } else { DEBUG(3, ("check_password: Password for user %s FAILED with error %s\n", user_info->smb_username.str, get_nt_error_msg(nt_status))); @@ -233,11 +233,11 @@ BOOL password_ok(char *user, char *password, int pwlen) /* The password could be either NTLM or plain LM. Try NTLM first, but fall-through as required. */ - if (pass_check_smb(user, lp_workgroup(), NULL, 0, (unsigned char *)password, pwlen) == NT_STATUS_NOPROBLEMO) { + if (pass_check_smb(user, lp_workgroup(), NULL, 0, (unsigned char *)password, pwlen) == NT_STATUS_OK) { return True; } - if (pass_check_smb(user, lp_workgroup(), (unsigned char *)password, pwlen, NULL, 0) == NT_STATUS_NOPROBLEMO) { + if (pass_check_smb(user, lp_workgroup(), (unsigned char *)password, pwlen, NULL, 0) == NT_STATUS_OK) { return True; } diff --git a/source3/smbd/auth_rhosts.c b/source3/smbd/auth_rhosts.c index f11f9cf777..a4914f2ef1 100644 --- a/source3/smbd/auth_rhosts.c +++ b/source3/smbd/auth_rhosts.c @@ -175,7 +175,7 @@ uint32 check_rhosts_security(const auth_usersupplied_info *user_info, become_root(); if (check_hosts_equiv(user_info->smb_username.str)) { - nt_status = NT_STATUS_NOPROBLEMO; + nt_status = NT_STATUS_OK; } unbecome_root(); diff --git a/source3/smbd/auth_server.c b/source3/smbd/auth_server.c index ad66f0c4ac..9636094fa3 100644 --- a/source3/smbd/auth_server.c +++ b/source3/smbd/auth_server.c @@ -214,7 +214,7 @@ use this machine as the password server.\n")); /* Make this cli_nt_error() when the conversion is in */ nt_status = NT_STATUS_LOGON_FAILURE; } else { - nt_status = NT_STATUS_NOPROBLEMO; + nt_status = NT_STATUS_OK; } /* if logged in as guest then reject */ diff --git a/source3/smbd/auth_smbpasswd.c b/source3/smbd/auth_smbpasswd.c index 1a5d02e4a4..5484758167 100644 --- a/source3/smbd/auth_smbpasswd.c +++ b/source3/smbd/auth_smbpasswd.c @@ -127,7 +127,7 @@ uint32 smb_password_ok(SAM_ACCOUNT *sampass, const auth_usersupplied_info *user_ if (lp_null_passwords()) { DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n", user_info->smb_username.str)); - return(NT_STATUS_NOPROBLEMO); + return(NT_STATUS_OK); } else { @@ -156,7 +156,7 @@ uint32 smb_password_ok(SAM_ACCOUNT *sampass, const auth_usersupplied_info *user_ user_info->requested_domain.str, (char *)server_info->session_key)) { - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } DEBUG(4,("smb_password_ok: NTLMv2 password check failed\n")); @@ -169,7 +169,7 @@ uint32 smb_password_ok(SAM_ACCOUNT *sampass, const auth_usersupplied_info *user_ nt_pw, user_info->chal, server_info->session_key)) { DEBUG(4,("smb_password_ok: NT MD4 password check succeeded\n")); - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } else { DEBUG(4,("smb_password_ok: NT MD4 password check failed\n")); return NT_STATUS_WRONG_PASSWORD; @@ -185,7 +185,7 @@ uint32 smb_password_ok(SAM_ACCOUNT *sampass, const auth_usersupplied_info *user_ lm_pw, user_info->chal, server_info->session_key)) { DEBUG(4,("smb_password_ok: LM password check succeeded\n")); - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } else { DEBUG(4,("smb_password_ok: LM password check failed\n")); return NT_STATUS_WRONG_PASSWORD; diff --git a/source3/smbd/auth_unix.c b/source3/smbd/auth_unix.c index 89e670747f..fda44fd91c 100644 --- a/source3/smbd/auth_unix.c +++ b/source3/smbd/auth_unix.c @@ -76,7 +76,7 @@ uint32 check_unix_security(const auth_usersupplied_info *user_info, auth_servers nt_status = (pass_check(user_info->smb_username.str, user_info->plaintext_password.str, user_info->plaintext_password.len, lp_update_encrypted() ? update_smbpassword_file : NULL) - ? NT_STATUS_NOPROBLEMO : NT_STATUS_LOGON_FAILURE); + ? NT_STATUS_OK : NT_STATUS_LOGON_FAILURE); unbecome_root(); return nt_status; diff --git a/source3/smbd/auth_util.c b/source3/smbd/auth_util.c index 4a0f45f843..5ccf963889 100644 --- a/source3/smbd/auth_util.c +++ b/source3/smbd/auth_util.c @@ -105,7 +105,7 @@ void smb_user_control(char *unix_user, uint32 nt_status) { struct passwd *pwd=NULL; - if(nt_status == NT_STATUS_NOPROBLEMO) { + if(nt_status == NT_STATUS_OK) { /* * User validated ok against Domain controller. * If the admin wants us to try and create a UNIX diff --git a/source3/smbd/error.c b/source3/smbd/error.c index f2613dc3a8..a74b62de01 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -84,7 +84,7 @@ int unix_error_packet(char *outbuf,int def_class,uint32 def_code,int line) } } - return error_packet(outbuf,NT_STATUS_OK,eclass,ecode,line); + return error_packet(outbuf,NT_STATUS(0),eclass,ecode,line); } @@ -119,7 +119,7 @@ int error_packet(char *outbuf,NTSTATUS ntstatus, } SSVAL(outbuf,smb_flg2, SVAL(outbuf,smb_flg2)&~FLAGS2_32_BIT_ERROR_CODES); - SVAL(outbuf,smb_rcls) = eclass; + SSVAL(outbuf,smb_rcls,eclass); SSVAL(outbuf,smb_err,ecode); DEBUG(3,("error packet at line %d cmd=%d (%s) eclass=%d ecode=%d\n", diff --git a/source3/smbd/service.c b/source3/smbd/service.c index edac97194e..df0f6f2095 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -217,14 +217,13 @@ int find_service(char *service) do some basic sainity checks on the share. This function modifies dev, ecode. ****************************************************************************/ -static BOOL share_sanity_checks(int snum, char* service, char *dev, int *ecode) +static NTSTATUS share_sanity_checks(int snum, char* service, char *dev) { if (!lp_snum_ok(snum) || !check_access(smbd_server_fd(), lp_hostsallow(snum), lp_hostsdeny(snum))) { - *ecode = ERRaccess; - return False; + return NT_STATUS_ACCESS_DENIED; } /* you can only connect to the IPC$ service as an ipc device */ @@ -243,15 +242,15 @@ static BOOL share_sanity_checks(int snum, char* service, char *dev, int *ecode) strupper(dev); if (!lp_print_ok(snum) && (strncmp(dev,"LPT",3) == 0)) { DEBUG(1,("Attempt to connect to non-printer as a printer\n")); - *ecode = ERRinvdevice; - return False; + return NT_STATUS_BAD_DEVICE_TYPE; } /* Behave as a printer if we are supposed to */ if (lp_print_ok(snum) && (strcmp(dev, "A:") == 0)) { pstrcpy(dev, "LPT1:"); } - return True; + + return NT_STATUS_OK; } @@ -319,7 +318,8 @@ static void set_admin_user(connection_struct *conn) /**************************************************************************** make a connection to a service ****************************************************************************/ -connection_struct *make_connection(char *service,char *user,char *password, int pwlen, char *dev,uint16 vuid, int *ecode) +connection_struct *make_connection(char *service,char *user,char *password, + int pwlen, char *dev,uint16 vuid, NTSTATUS *status) { int snum; struct passwd *pass = NULL; @@ -334,13 +334,13 @@ connection_struct *make_connection(char *service,char *user,char *password, int if (snum < 0) { if (strequal(service,"IPC$") || strequal(service,"ADMIN$")) { DEBUG(3,("refusing IPC connection\n")); - *ecode = ERRnoipc; + *status = NT_STATUS_ACCESS_DENIED; return NULL; } DEBUG(0,("%s (%s) couldn't find service %s\n", remote_machine, client_addr(), service)); - *ecode = ERRnosuchshare; + *status = NT_STATUS_BAD_NETWORK_PATH; return NULL; } @@ -349,7 +349,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int fstring dos_username; fstrcpy(dos_username, user); return(make_connection(dos_username,user,password, - pwlen,dev,vuid,ecode)); + pwlen,dev,vuid,status)); } if(lp_security() != SEC_SHARE) { @@ -357,7 +357,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int fstring dos_username; fstrcpy(user,validated_username(vuid)); fstrcpy(dos_username, user); - return(make_connection(dos_username,user,password,pwlen,dev,vuid,ecode)); + return(make_connection(dos_username,user,password,pwlen,dev,vuid,status)); } } else { /* Security = share. Try with current_user_info.smb_name @@ -366,12 +366,12 @@ connection_struct *make_connection(char *service,char *user,char *password, int fstring dos_username; fstrcpy(user,current_user_info.smb_name); fstrcpy(dos_username, user); - return(make_connection(dos_username,user,password,pwlen,dev,vuid,ecode)); + return(make_connection(dos_username,user,password,pwlen,dev,vuid,status)); } } } - if (!share_sanity_checks(snum, service, dev, ecode)) { + if (NT_STATUS_IS_ERR(share_sanity_checks(snum, service, dev))) { return NULL; } @@ -387,14 +387,14 @@ connection_struct *make_connection(char *service,char *user,char *password, int /* shall we let them in? */ if (!authorise_login(snum,user,password,pwlen,&guest,&force,vuid)) { DEBUG( 2, ( "Invalid username/password for %s [%s]\n", service, user ) ); - *ecode = ERRbadpw; + *status = NT_STATUS_WRONG_PASSWORD; return NULL; } conn = conn_new(); if (!conn) { DEBUG(0,("Couldn't find free connection.\n")); - *ecode = ERRnoresource; + *status = NT_STATUS_INSUFFICIENT_RESOURCES; return NULL; } @@ -403,7 +403,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int if (pass == NULL) { DEBUG(0,( "Couldn't find account %s\n",user)); - *ecode = ERRbaduid; + *status = NT_STATUS_NO_SUCH_USER; conn_free(conn); return NULL; } @@ -543,7 +543,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int if (!can_write) { if (!share_access_check(conn, snum, vuid, FILE_READ_DATA)) { /* No access, read or write. */ - *ecode = ERRaccess; + *status = NT_STATUS_ACCESS_DENIED; DEBUG(0,( "make_connection: connection to %s denied due to security descriptor.\n", service )); conn_free(conn); @@ -567,7 +567,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int lp_max_connections(SNUM(conn)), False)) { DEBUG(1,("too many connections - rejected\n")); - *ecode = ERRnoresource; + *status = NT_STATUS_INSUFFICIENT_RESOURCES; conn_free(conn); return NULL; } @@ -585,7 +585,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn))); conn_free(conn); - *ecode = ERRsrverror; + *status = NT_STATUS_UNSUCCESSFUL; return NULL; } } @@ -596,7 +596,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn))); conn_free(conn); - *ecode = ERRbadpw; + *status = NT_STATUS_WRONG_PASSWORD; return NULL; } @@ -609,7 +609,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn))); conn_free(conn); - *ecode = ERRnosuchshare; + *status = NT_STATUS_BAD_NETWORK_NAME; return NULL; } @@ -638,7 +638,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int DEBUG(1,("preexec gave %d - failing connection\n", ret)); yield_connection(conn, lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn))); conn_free(conn); - *ecode = ERRsrverror; + *status = NT_STATUS_UNSUCCESSFUL; return NULL; } } |