summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-26 05:40:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:18 -0500
commit8b3f08cefcd41e6f8005de84a2cc865c1011194d (patch)
tree77cd0b79d7721efe12fcf1a481df52d02727ecd0 /source4
parent406f345d889d7e804c5d861223fa66abb213bb23 (diff)
downloadsamba-8b3f08cefcd41e6f8005de84a2cc865c1011194d.tar.gz
samba-8b3f08cefcd41e6f8005de84a2cc865c1011194d.tar.bz2
samba-8b3f08cefcd41e6f8005de84a2cc865c1011194d.zip
r898: - remove some unused macros
- remove unused lib/smbpasswd.c - don't set the pkt size twice when doing SMB signing (This used to be commit 69a2942f7987647a32d43c71f41ac1a82a82ccda)
Diffstat (limited to 'source4')
-rw-r--r--source4/include/includes.h10
-rw-r--r--source4/include/smb.h63
-rw-r--r--source4/include/smb_macros.h10
-rw-r--r--source4/lib/basic.mk1
-rw-r--r--source4/lib/smbpasswd.c200
-rw-r--r--source4/libcli/util/errormap.c7
-rw-r--r--source4/smb_server/request.c4
7 files changed, 7 insertions, 288 deletions
diff --git a/source4/include/includes.h b/source4/include/includes.h
index 441111ed6f..5aa46c36cf 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -436,12 +436,6 @@ typedef int socklen_t;
#define uchar unsigned char
#endif
-#ifdef HAVE_UNSIGNED_CHAR
-#define schar signed char
-#else
-#define schar char
-#endif
-
/*
Samba needs type definitions for
int8_t, int16_t, int32_t, int64_t
@@ -711,10 +705,6 @@ typedef int (*comparison_fn_t)(const void *, const void *);
#define MAP_FILE 0
#endif
-#if (!defined(WITH_LDAP) && !defined(WITH_TDB_SAM))
-#define USE_SMBPASS_DB 1
-#endif
-
#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
#define OSF1_ENH_SEC 1
#endif
diff --git a/source4/include/smb.h b/source4/include/smb.h
index 45a7bd0b2f..c6866c52b4 100644
--- a/source4/include/smb.h
+++ b/source4/include/smb.h
@@ -44,12 +44,6 @@ typedef int BOOL;
#define _BOOL /* So we don't typedef BOOL again in vfs.h */
#endif
-#define SIZEOFWORD 2
-
-#ifndef DEF_CREATE_MASK
-#define DEF_CREATE_MASK (0755)
-#endif
-
/* string manipulation flags - see clistr.c and srvstr.c */
#define STR_TERMINATE 1
#define STR_UPPER 2
@@ -238,8 +232,6 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
/* turn a 7 bit character into a ucs2 character */
#define UCS2_CHAR(c) ((c) << UCS2_SHIFT)
-#define MAX_HOURS_LEN 32
-
/* for compatibility */
#define SID_NAME_USE samr_SidType
@@ -261,12 +253,6 @@ typedef struct nt_user_token {
struct dom_sid **user_sids;
} NT_USER_TOKEN;
-/* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */
-typedef struct time_info
-{
- uint32_t time;
-} UTIME;
-
/* used to hold an arbitrary blob of data */
typedef struct data_blob {
uint8_t *data;
@@ -686,18 +672,6 @@ struct bitmap {
otherwise NT will not honour the announce packets */
#define MAX_SERVER_STRING_LENGTH 48
-
-#define SMB_SUCCESS 0 /* The request was successful. */
-
-#ifdef WITH_DFS
-void dfs_unlogin(void);
-extern int dcelogin_atmost_once;
-#endif
-
-#ifdef NOSTRDUP
-char *strdup(char *s);
-#endif
-
#ifndef SIGNAL_CAST
#define SIGNAL_CAST (RETSIGTYPE (*)(int))
#endif
@@ -892,28 +866,6 @@ struct node_status {
unsigned char flags;
};
-struct pwd_info
-{
- BOOL null_pwd;
- BOOL cleartext;
- BOOL crypted;
-
- fstring password;
-
- uchar smb_lm_pwd[16];
- uchar smb_nt_pwd[16];
-
- uchar smb_lm_owf[24];
- uchar smb_nt_owf[128];
- size_t nt_owf_len;
-
- uchar lm_cli_chal[8];
- uchar nt_cli_chal[128];
- size_t nt_cli_chal_len;
-
- uchar sess_key[16];
-};
-
#include "rpc_secdes.h"
typedef struct user_struct
@@ -931,24 +883,9 @@ typedef struct user_struct
} user_struct;
-struct unix_error_map {
- int unix_error;
- int dos_class;
- int dos_code;
- NTSTATUS nt_error;
-};
-
#include "client.h"
/*
- * Size of new password account encoding string. This is enough space to
- * hold 11 ACB characters, plus the surrounding [] and a terminating null.
- * Do not change unless you are adding new ACB bits!
- */
-
-#define NEW_PW_FORMAT_SPACE_PADDED_LEN 14
-
-/*
Do you want session setups at user level security with a invalid
password to be rejected or allowed in as guest? WinNT rejects them
but it can be a pain as it means "net view" needs to use a password
diff --git a/source4/include/smb_macros.h b/source4/include/smb_macros.h
index 6dc78a1795..bbf904fbfa 100644
--- a/source4/include/smb_macros.h
+++ b/source4/include/smb_macros.h
@@ -108,20 +108,10 @@
/* these are the datagram types */
#define DGRAM_DIRECT_UNIQUE 0x10
-#define ERROR_DOS(class,code) error_packet(outbuf,NT_STATUS_OK,class,code,__LINE__,__FILE__)
-#define ERROR_NT(status) error_packet(outbuf,status,0,0,__LINE__,__FILE__)
-#define ERROR_BOTH(status,class,code) error_packet(outbuf,status,class,code,__LINE__,__FILE__)
-
-/* this is how errors are generated */
-#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__,__FILE__)
/* REWRITE TODO: remove these smb_xxx macros */
#define smb_buf(buf) (((char *)(buf)) + MIN_SMB_SIZE + CVAL(buf,HDR_WCT+4)*2)
-/* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */
-#define smb_bufrem(buf, p) (smb_buflen(buf)-PTR_DIFF(p, smb_buf(buf)))
-
-
#define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|(PVAL(buf,1)<<16))
#define _smb_setlen(buf,len) do {(buf)[0] = 0; (buf)[1] = ((len)&0x10000)>>16; \
(buf)[2] = ((len)&0xFF00)>>8; (buf)[3] = (len)&0xFF;} while (0)
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 865ba7342f..ce82157894 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -39,7 +39,6 @@ ADD_OBJ_FILES = \
lib/messages.o \
lib/tallocmsg.o \
lib/dmallocmsg.o \
- lib/smbpasswd.o \
lib/pam_errors.o \
intl/lang_tdb.o \
lib/gencache.o \
diff --git a/source4/lib/smbpasswd.c b/source4/lib/smbpasswd.c
deleted file mode 100644
index 5cb8439878..0000000000
--- a/source4/lib/smbpasswd.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- smbpasswd file format routines
-
- Copyright (C) Andrew Tridgell 1992-1998
- Modified by Jeremy Allison 1995.
- Modified by Gerald (Jerry) Carter 2000-2001
- Copyright (C) Tim Potter 2001
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/*! \file lib/smbpasswd.c
-
- The smbpasswd file is used to store encrypted passwords in a similar
- fashion to the /etc/passwd file. The format is colon separated fields
- with one user per line like so:
-
- <username>:<uid>:<lanman hash>:<nt hash>:<acb info>:<last change time>
-
- The username and uid must correspond to an entry in the /etc/passwd
- file. The lanman and nt password hashes are 32 hex digits corresponding
- to the 16-byte lanman and nt hashes respectively.
-
- The password last change time is stored as a string of the format
- LCD-<change time> where the change time is expressed as an
-
- 'N' No password
- 'D' Disabled
- 'H' Homedir required
- 'T' Temp account.
- 'U' User account (normal)
- 'M' MNS logon user account - what is this ?
- 'W' Workstation account
- 'S' Server account
- 'L' Locked account
- 'X' No Xpiry on password
- 'I' Interdomain trust account
-
-*/
-
-#include "includes.h"
-
-/*! Convert 32 hex characters into a 16 byte array. */
-
-BOOL smbpasswd_gethexpwd(char *p, unsigned char *pwd)
-{
- int i;
- unsigned char lonybble, hinybble;
- const char *hexchars = "0123456789ABCDEF";
- char *p1, *p2;
-
- if (!p) return (False);
-
- for (i = 0; i < 32; i += 2)
- {
- hinybble = toupper(p[i]);
- lonybble = toupper(p[i + 1]);
-
- p1 = strchr_m(hexchars, hinybble);
- p2 = strchr_m(hexchars, lonybble);
-
- if (!p1 || !p2)
- {
- return (False);
- }
-
- hinybble = PTR_DIFF(p1, hexchars);
- lonybble = PTR_DIFF(p2, hexchars);
-
- pwd[i / 2] = (hinybble << 4) | lonybble;
- }
- return (True);
-}
-
-/*! Convert a 16-byte array into 32 hex characters. */
-
-void smbpasswd_sethexpwd(fstring p, unsigned char *pwd, uint16_t acb_info)
-{
- if (pwd != NULL) {
- int i;
- for (i = 0; i < 16; i++)
- slprintf(&p[i*2], 3, "%02X", pwd[i]);
- } else {
- if (acb_info & ACB_PWNOTREQ)
- safe_strcpy(p, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX", 33);
- else
- safe_strcpy(p, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 33);
- }
-}
-
-/*! Decode the account control bits (ACB) info from a string. */
-
-uint16_t smbpasswd_decode_acb_info(const char *p)
-{
- uint16_t acb_info = 0;
- BOOL finished = False;
-
- /*
- * Check if the account type bits have been encoded after the
- * NT password (in the form [NDHTUWSLXI]).
- */
-
- if (*p != '[') return 0;
-
- for (p++; *p && !finished; p++)
- {
- switch (*p) {
- case 'N': /* 'N'o password. */
- acb_info |= ACB_PWNOTREQ;
- break;
- case 'D': /* 'D'isabled. */
- acb_info |= ACB_DISABLED;
- break;
- case 'H': /* 'H'omedir required. */
- acb_info |= ACB_HOMDIRREQ;
- break;
- case 'T': /* 'T'emp account. */
- acb_info |= ACB_TEMPDUP;
- break;
- case 'U': /* 'U'ser account (normal). */
- acb_info |= ACB_NORMAL;
- break;
- case 'M': /* 'M'NS logon user account. What is this ? */
- acb_info |= ACB_MNS;
- break;
- case 'W': /* 'W'orkstation account. */
- acb_info |= ACB_WSTRUST;
- break;
- case 'S': /* 'S'erver account. */
- acb_info |= ACB_SVRTRUST;
- break;
- case 'L': /* 'L'ocked account. */
- acb_info |= ACB_AUTOLOCK;
- break;
- case 'X': /* No 'X'piry on password */
- acb_info |= ACB_PWNOEXP;
- break;
- case 'I': /* 'I'nterdomain trust account. */
- acb_info |= ACB_DOMTRUST;
- break;
-
- case ' ':
- break;
- case ':':
- case '\n':
- case '\0':
- case ']':
- default:
- finished = True;
- break;
- }
- }
-
- return acb_info;
-}
-
-/*! Encode account control bits (ACBs) into a string. */
-
-char *smbpasswd_encode_acb_info(uint16_t acb_info)
-{
- static fstring acct_str;
- size_t i = 0;
-
- acct_str[i++] = '[';
-
- if (acb_info & ACB_PWNOTREQ ) acct_str[i++] = 'N';
- if (acb_info & ACB_DISABLED ) acct_str[i++] = 'D';
- if (acb_info & ACB_HOMDIRREQ) acct_str[i++] = 'H';
- if (acb_info & ACB_TEMPDUP ) acct_str[i++] = 'T';
- if (acb_info & ACB_NORMAL ) acct_str[i++] = 'U';
- if (acb_info & ACB_MNS ) acct_str[i++] = 'M';
- if (acb_info & ACB_WSTRUST ) acct_str[i++] = 'W';
- if (acb_info & ACB_SVRTRUST ) acct_str[i++] = 'S';
- if (acb_info & ACB_AUTOLOCK ) acct_str[i++] = 'L';
- if (acb_info & ACB_PWNOEXP ) acct_str[i++] = 'X';
- if (acb_info & ACB_DOMTRUST ) acct_str[i++] = 'I';
-
- for ( ; i < NEW_PW_FORMAT_SPACE_PADDED_LEN - 2 ; i++ )
- acct_str[i] = ' ';
-
- i = NEW_PW_FORMAT_SPACE_PADDED_LEN - 2;
- acct_str[i++] = ']';
- acct_str[i++] = '\0';
-
- return acct_str;
-}
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index 46290baa7c..e2aeded65d 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -1486,6 +1486,13 @@ WERROR ntstatus_to_werror(NTSTATUS error)
/* Mapping between Unix, DOS and NT error numbers */
+struct unix_error_map {
+ int unix_error;
+ int dos_class;
+ int dos_code;
+ NTSTATUS nt_error;
+};
+
const struct unix_error_map unix_dos_nt_errmap[] = {
{ EPERM, ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED },
{ EACCES, ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED },
diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c
index 4f7eb01103..5b1335a651 100644
--- a/source4/smb_server/request.c
+++ b/source4/smb_server/request.c
@@ -277,10 +277,6 @@ void req_send_reply_nosign(struct request_context *req)
*/
void req_send_reply(struct request_context *req)
{
- if (req->out.size > NBT_HDR_SIZE) {
- _smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE);
- }
-
req_sign_packet(req);
req_send_reply_nosign(req);