summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-06-06 11:43:09 +0000
committerAndrew Tridgell <tridge@samba.org>1996-06-06 11:43:09 +0000
commitb9ae225b28f4707609e6436dad4be7ebdd7e181f (patch)
treede9b672d8fd9cbb0e79039f7ea543b4c4793a2d1 /source3/smbd
parentf57b053db8b17041ef02588127a67f362af871b6 (diff)
downloadsamba-b9ae225b28f4707609e6436dad4be7ebdd7e181f.tar.gz
samba-b9ae225b28f4707609e6436dad4be7ebdd7e181f.tar.bz2
samba-b9ae225b28f4707609e6436dad4be7ebdd7e181f.zip
- added interface.c and removed all the references to myip, bcast_ip
and Netmask, instead replacing them with calls to routines in interface.c - got rid of old MAXINT define - added code to ensure we only return one entry for each name in the ipc enum routines - added new_only option to add_netbios_entry() to prevent overwriting of important names - minor time handling fixup (This used to be commit 7ed71b73ae745da099072eee36fc2700d1d91407)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c63
-rw-r--r--source3/smbd/password.c4
-rw-r--r--source3/smbd/server.c6
3 files changed, 47 insertions, 26 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 25979d72f5..916b0fb88e 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -808,7 +808,8 @@ static BOOL filter_server_info(struct srv_info_struct *server,
number of entries
******************************************************************/
static int get_server_info(uint32 servertype,
- struct srv_info_struct **servers, BOOL domains, char *domain)
+ struct srv_info_struct **servers, BOOL domains,
+ char *domain)
{
FILE *f;
pstring fname;
@@ -831,7 +832,7 @@ static int get_server_info(uint32 servertype,
/* request for everything is code for request all servers */
if (servertype == SV_TYPE_ALL) servertype &= ~SV_TYPE_DOMAIN_ENUM;
- DEBUG(4, ("Servertype search: %8x domains:%s\n", servertype,BOOLSTR(domains)));
+ DEBUG(4,("Servertype search: %8x domains:%s\n",servertype,BOOLSTR(domains)));
while (!feof(f))
{
@@ -861,10 +862,16 @@ static int get_server_info(uint32 servertype,
strcpy(s->domain,my_workgroup());
}
- if (sscanf(stype,"%X",&s->type) != 1) { DEBUG(4,("r:host file ")); ok = False; }
+ if (sscanf(stype,"%X",&s->type) != 1) {
+ DEBUG(4,("r:host file "));
+ ok = False;
+ }
/* doesn't match up: don't want it */
- if (!(servertype & s->type)) { DEBUG(4,("r:serv type ")); ok = False; }
+ if (!(servertype & s->type)) {
+ DEBUG(4,("r:serv type "));
+ ok = False;
+ }
if ((servertype == ~SV_TYPE_DOMAIN_ENUM) &&
(s->type & SV_TYPE_DOMAIN_ENUM))
@@ -902,6 +909,7 @@ static int get_server_info(uint32 servertype,
return(count);
}
+
/*******************************************************************
fill in a server info structure
******************************************************************/
@@ -981,6 +989,11 @@ static int fill_srv_info(struct srv_info_struct *service,
}
+static BOOL srv_comp(struct srv_info_struct *s1,struct srv_info_struct *s2)
+{
+ return(strcmp(s1->name,s2->name));
+}
+
/****************************************************************************
view list of servers available (or possibly domains). The info is
extracted from lists saved by nmbd on the local host
@@ -1038,23 +1051,30 @@ static BOOL api_RNetServerEnum(int cnum, int uid, char *param, char *data,
data_len = fixed_len = string_len = 0;
+ qsort(servers,total,sizeof(servers[0]),QSORT_CAST srv_comp);
+
{
+ char *lastname=NULL;
+
for (i=0;i<total;i++)
{
struct srv_info_struct *s = &servers[i];
- if (filter_server_info(s,domains,domain,local_request|domain_request))
- {
- data_len += fill_srv_info(s,uLevel,0,&f_len,0,&s_len,0);
- DEBUG(4,("fill_srv_info %20s %8x %25s %15s\n",
- s->name, s->type, s->comment, s->domain));
-
- if (data_len <= buf_len)
+ if (filter_server_info(s,domains,domain,
+ local_request|domain_request))
+ {
+ if (lastname && strequal(lastname,s->name)) continue;
+ lastname = s->name;
+ data_len += fill_srv_info(s,uLevel,0,&f_len,0,&s_len,0);
+ DEBUG(4,("fill_srv_info %20s %8x %25s %15s\n",
+ s->name, s->type, s->comment, s->domain));
+
+ if (data_len <= buf_len)
{
counted++;
fixed_len += f_len;
string_len += s_len;
}
- }
+ }
}
}
@@ -1068,18 +1088,21 @@ static BOOL api_RNetServerEnum(int cnum, int uid, char *param, char *data,
s_len = string_len;
{
+ char *lastname=NULL;
int count2 = counted;
for (i = 0; i < total && count2;i++)
- {
- struct srv_info_struct *s = &servers[i];
- if (filter_server_info(s,domains,domain,local_request|domain_request))
{
- fill_srv_info(s,uLevel,&p,&f_len,&p2,&s_len,*rdata);
- DEBUG(4,("fill_srv_info %20s %8x %25s %15s\n",
- s->name, s->type, s->comment, s->domain));
- count2--;
+ struct srv_info_struct *s = &servers[i];
+ if (filter_server_info(s,domains,domain,local_request|domain_request))
+ {
+ if (lastname && strequal(lastname,s->name)) continue;
+ lastname = s->name;
+ fill_srv_info(s,uLevel,&p,&f_len,&p2,&s_len,*rdata);
+ DEBUG(4,("fill_srv_info %20s %8x %25s %15s\n",
+ s->name, s->type, s->comment, s->domain));
+ count2--;
+ }
}
- }
}
*rparam_len = 8;
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 31d9191271..c2fe8a4f0d 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -43,7 +43,6 @@ Get the next challenge value - no repeats.
********************************************************************/
void generate_next_challenge(char *challenge)
{
- extern void E1(char *,char *,char *);
static int counter = 0;
struct timeval tval;
int v1,v2;
@@ -1257,7 +1256,6 @@ BOOL server_cryptkey(char *buf)
int len;
fstring desthost;
struct in_addr dest_ip;
- extern struct in_addr myip;
int port = SMB_PORT;
BOOL ret;
@@ -1285,7 +1283,7 @@ BOOL server_cryptkey(char *buf)
continue;
}
- if (memcmp(&dest_ip,&myip,sizeof(dest_ip)) == 0) {
+ if (ismyip(dest_ip)) {
DEBUG(1,("Password server loop - disabling password server %s\n",p));
continue;
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 206d89423f..25464d861c 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -79,8 +79,6 @@ int unix_ERR_code=0;
extern int extra_time_offset;
extern pstring myhostname;
-extern struct in_addr myip;
-
static int find_free_connection(int hash);
@@ -1778,6 +1776,8 @@ BOOL reload_services(BOOL test)
reopen_logs();
+ load_interfaces();
+
{
extern int Client;
if (Client != -1) {
@@ -3550,7 +3550,7 @@ static void process(void)
static void init_structs(void )
{
int i;
- get_myname(myhostname,&myip);
+ get_myname(myhostname,NULL);
for (i=0;i<MAX_CONNECTIONS;i++)
{