summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c61
-rw-r--r--source3/smbd/pipes.c17
-rw-r--r--source3/smbd/reply.c16
-rw-r--r--source3/smbd/server.c2
4 files changed, 77 insertions, 19 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index dd9b9661ae..580aa446b6 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -439,7 +439,7 @@ static void PackDriverData(struct pack_desc* desc)
}
static int check_printq_info(struct pack_desc* desc,
- int uLevel, const char* id1, const char* id2)
+ int uLevel, char *id1, const char* id2)
{
desc->subformat = NULL;
switch( uLevel ) {
@@ -812,10 +812,7 @@ static int get_server_info(uint32 servertype,
if (!next_token(&ptr,s->name , NULL)) continue;
if (!next_token(&ptr,stype , NULL)) continue;
if (!next_token(&ptr,s->comment, NULL)) continue;
- if (!next_token(&ptr,s->domain , NULL)) {
- /* this allows us to cope with an old nmbd */
- strcpy(s->domain,lp_workgroup());
- }
+ if (!next_token(&ptr,s->domain , NULL)) continue;
if (sscanf(stype,"%X",&s->type) != 1) {
DEBUG(4,("r:host file "));
@@ -983,8 +980,22 @@ static BOOL api_RNetServerEnum(int cnum, int uid, char *param, char *data,
if (strcmp(str1, "WrLehDz") == 0) {
StrnCpy(domain, p, sizeof(fstring)-1);
- } else {
- StrnCpy(domain, lp_workgroup(), sizeof(fstring)-1);
+ }
+ else
+ {
+ /* a server will connect to us under one of samba's NetBIOS
+ name aliases, and by not giving us a domain name it
+ assumes we know which domain it's talking about.
+ do a look-up for the workgroup name against the name
+ the host connected to us as.
+ */
+
+ char *work_alias;
+
+ work_alias = conf_alias_to_workgroup(local_machine); /* look-up */
+
+ if (work_alias)
+ StrnCpy(domain, work_alias, sizeof(fstring)-1);
}
if (lp_browse_list())
@@ -1349,7 +1360,7 @@ static BOOL api_SetUserPassword(int cnum,int uid, char *param,char *data,
DEBUG(3,("Set password for <%s>\n",user));
- if (password_ok(user,pass1,strlen(pass1),NULL,False) &&
+ if (password_ok(user,pass1,strlen(pass1),NULL) &&
chgpasswd(user,pass1,pass2))
{
SSVAL(*rparam,0,NERR_Success);
@@ -1668,9 +1679,19 @@ static BOOL api_RNetServerGetInfo(int cnum,int uid, char *param,char *data,
pstring comment;
uint32 servertype=DFLT_SERVER_TYPE;
+ char *work_alias;
+ char domain[16];
+
+ work_alias = conf_alias_to_workgroup(local_machine); /* look-up */
+
+ if (work_alias)
+ StrnCpy(domain, work_alias, sizeof(fstring)-1);
+ else
+ *domain = 0;
+
strcpy(comment,lp_serverstring());
- if ((count=get_server_info(SV_TYPE_ALL,&servers,lp_workgroup()))>0) {
+ if ((count=get_server_info(SV_TYPE_ALL,&servers,domain))>0) {
for (i=0;i<count;i++)
if (strequal(servers[i].name,local_machine)) {
servertype = servers[i].type;
@@ -1723,6 +1744,14 @@ static BOOL api_NetWkstaGetInfo(int cnum,int uid, char *param,char *data,
char *p2;
extern pstring sesssetup_user;
int level = SVAL(p,0);
+ char domain[17];
+
+ char *work_alias = conf_alias_to_workgroup(local_machine); /* look-up */
+
+ if (work_alias)
+ StrnCpy(domain, work_alias, 16);
+ else
+ StrnCpy(domain, lp_workgroup(), 16);
DEBUG(4,("NetWkstaGetInfo level %d\n",level));
@@ -1753,7 +1782,7 @@ static BOOL api_NetWkstaGetInfo(int cnum,int uid, char *param,char *data,
p += 4;
SIVAL(p,0,PTR_DIFF(p2,*rdata));
- strcpy(p2,lp_workgroup());
+ StrCpy(p2,domain);
p2 = skip_string(p2,1);
p += 4;
@@ -1762,7 +1791,7 @@ static BOOL api_NetWkstaGetInfo(int cnum,int uid, char *param,char *data,
p += 2;
SIVAL(p,0,PTR_DIFF(p2,*rdata));
- strcpy(p2,lp_workgroup()); /* login domain?? */
+ strcpy(p2,domain); /* login domain?? */
p2 = skip_string(p2,1);
p += 4;
@@ -1985,6 +2014,14 @@ static BOOL api_WWkstaUserLogon(int cnum,int uid, char *param,char *data,
int uLevel;
struct pack_desc desc;
char* name;
+ char domain[17];
+
+ char *work_alias = conf_alias_to_workgroup(local_machine); /* look-up */
+
+ if (work_alias)
+ StrnCpy(domain, work_alias, 16);
+ else
+ StrnCpy(domain, lp_workgroup(), 16);
uLevel = SVAL(p,0);
name = p + 2;
@@ -2027,7 +2064,7 @@ static BOOL api_WWkstaUserLogon(int cnum,int uid, char *param,char *data,
strupper(mypath);
PACKS(&desc,"z",mypath); /* computer */
}
- PACKS(&desc,"z",lp_workgroup());/* domain */
+ PACKS(&desc,"z",domain);/* domain */
PACKS(&desc,"z",lp_logon_script()); /* script path */
PACKI(&desc,"D",0); /* reserved */
}
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index ffa46083c3..35f8d684eb 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -44,6 +44,8 @@ extern BOOL case_sensitive;
extern pstring sesssetup_user;
extern int Client;
+extern pstring local_machine;
+
/* this macro should always be used to extract an fnum (smb_fid) from
a packet to ensure chaining works correctly */
#define GETFNUM(buf,where) (chain_fnum!= -1?chain_fnum:SVAL(buf,where))
@@ -251,9 +253,18 @@ static void LsarpcTNP3(char *data,char **rdata, int *rdata_len)
{
uint32 dword1;
uint16 word1;
- char * workgroup = lp_workgroup();
- int wglen = strlen(workgroup);
+ int wglen;
int i;
+ char domain[17];
+
+ char *work_alias = conf_alias_to_workgroup(local_machine); /* look-up */
+
+ if (work_alias)
+ StrnCpy(domain, work_alias, 16);
+ else
+ StrnCpy(domain, lp_workgroup(), 16);
+
+ wglen = strlen(domain);
/* All kinds of mysterious numbers here */
*rdata_len = 90 + 2 * wglen;
@@ -279,7 +290,7 @@ static void LsarpcTNP3(char *data,char **rdata, int *rdata_len)
SIVAL(*rdata,0x2C,4);
SIVAL(*rdata,0x34,wglen);
for ( i = 0 ; i < wglen ; i++ )
- (*rdata)[0x38 + i * 2] = workgroup[i];
+ (*rdata)[0x38 + i * 2] = domain[i];
/* Now fill in the rest */
i = 0x38 + wglen * 2;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7241aadac0..b99aef7528 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -37,6 +37,7 @@ extern connection_struct Connections[];
extern files_struct Files[];
extern BOOL case_sensitive;
extern pstring sesssetup_user;
+extern fstring local_machine;
extern int Client;
/* this macro should always be used to extract an fnum (smb_fid) from
@@ -54,7 +55,6 @@ int reply_special(char *inbuf,char *outbuf)
int msg_flags = CVAL(inbuf,1);
pstring name1,name2;
extern fstring remote_machine;
- extern fstring local_machine;
char *p;
*name1 = *name2 = 0;
@@ -319,6 +319,14 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
BOOL guest=False;
BOOL computer_id=False;
+ char domain[17];
+
+ char *work_alias = conf_alias_to_workgroup(local_machine); /* look-up */
+
+ if (work_alias)
+ StrnCpy(domain, work_alias, 16);
+ else
+ StrnCpy(domain, lp_workgroup(), 16);
*smb_apasswd = 0;
sess_uid = SVAL(inbuf,smb_uid);
@@ -404,12 +412,12 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
first. This is superior as the passwords are mixed case 128 length unicode */
if(smb_ntpasslen && !guest)
{
- if(!password_ok(user,smb_ntpasswd,smb_ntpasslen,NULL,True))
+ if(!password_ok(user,smb_ntpasswd,smb_ntpasslen,NULL))
DEBUG(0,("NT Password did not match ! Defaulting to Lanman\n"));
else
valid_nt_password = True;
}
- if (!valid_nt_password && !guest && !password_ok(user,smb_apasswd,smb_apasslen,NULL,False))
+ if (!valid_nt_password && !guest && !password_ok(user,smb_apasswd,smb_apasslen,NULL))
{
if (!computer_id && lp_security() >= SEC_USER) {
#if (GUEST_SESSSETUP == 0)
@@ -452,7 +460,7 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
p = smb_buf(outbuf);
strcpy(p,"Unix"); p = skip_string(p,1);
strcpy(p,"Samba "); strcat(p,VERSION); p = skip_string(p,1);
- strcpy(p,lp_workgroup()); p = skip_string(p,1);
+ strcpy(p,domain); p = skip_string(p,1);
set_message(outbuf,3,PTR_DIFF(p,smb_buf(outbuf)),False);
/* perhaps grab OS version here?? */
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 0e0a524f16..4aaab4c087 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -3746,6 +3746,8 @@ static void usage(char *pname)
DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir()));
}
+ read_smbbrowse_conf(myhostname);
+
process();
close_sockets();