summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-07-28 18:59:57 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-07-28 18:59:57 +0000
commit7314126d9e1d84997d818166f27e2076d55ff04e (patch)
treeafcef3a4f75a6b7441d5ce5efdf790167ee65f78
parentbfdaaaf36d55051bf60d30648b87b96ed87b9ba5 (diff)
downloadsamba-7314126d9e1d84997d818166f27e2076d55ff04e.tar.gz
samba-7314126d9e1d84997d818166f27e2076d55ff04e.tar.bz2
samba-7314126d9e1d84997d818166f27e2076d55ff04e.zip
client.c: Added amanda fixes.
clitar.c: Added amanda fixes. nameannounce.c: Removed redundent code. nameelect.c: Removed redundent code. nameserv.h: Removed redundent code. nameservresp.c: Removed redundent code. namework.c: Removed redundent code. password.c: Prevented crash if getpwnam fails. Jeremy (jallison@whistle.com) (This used to be commit 760fe30353de66e8e6571f8ff4ec1064261b5428)
-rw-r--r--source3/client/client.c16
-rw-r--r--source3/client/clitar.c8
-rw-r--r--source3/include/nameserv.h1
-rw-r--r--source3/nameannounce.c119
-rw-r--r--source3/nameelect.c2
-rw-r--r--source3/nameservresp.c91
-rw-r--r--source3/namework.c10
-rw-r--r--source3/smbd/password.c16
8 files changed, 66 insertions, 197 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index c52815c25b..84ff1b50c8 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -85,7 +85,7 @@ static BOOL call_api(int prcnt,int drcnt,
int *rprcnt,int *rdrcnt,
char *param,char *data,
char **rparam,char **rdata);
-
+static BOOL do_this_one(file_info *finfo);
/* clitar bits insert */
extern int blocksize;
@@ -135,6 +135,8 @@ int get_total_time_ms = 0;
int put_total_size = 0;
int put_total_time_ms = 0;
+/* totals globals */
+int dir_total = 0;
extern int Client;
@@ -473,12 +475,15 @@ static void cmd_cd(char *inbuf,char *outbuf)
****************************************************************************/
static void display_finfo(file_info *finfo)
{
- time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
- DEBUG(0,(" %-30s%7.7s%10d %s",
- CNV_LANG(finfo->name),
+ if (do_this_one(finfo)) {
+ time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
+ DEBUG(0,(" %-30s%7.7s%10d %s",
+ CNV_LANG(finfo->name),
attrib_string(finfo->mode),
finfo->size,
asctime(LocalTime(&t))));
+ dir_total += finfo->size;
+ }
}
@@ -1104,6 +1109,7 @@ static void cmd_dir(char *inbuf,char *outbuf)
fstring buf;
char *p=buf;
+ dir_total = 0;
strcpy(mask,cur_dir);
if(mask[strlen(mask)-1]!='\\')
strcat(mask,"\\");
@@ -1122,6 +1128,8 @@ static void cmd_dir(char *inbuf,char *outbuf)
do_dir(inbuf,outbuf,mask,attribute,NULL,recurse);
do_dskattr();
+
+ DEBUG(3, ("Total bytes listed: %d\n", dir_total));
}
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 951947ecb2..f70e639e90 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -41,7 +41,7 @@ static int attribute = aDIR | aSYSTEM | aHIDDEN;
#endif
static char *tarbuf;
-static int tp, ntarf, tbufsiz;
+static int tp, ntarf, tbufsiz, ttarf;
/* Incremental mode */
BOOL tar_inc=False;
/* Reset archive bit */
@@ -271,8 +271,8 @@ static void initarbuf()
tbufsiz=blocksize*TBLOCK;
tarbuf=malloc(tbufsiz);
- /* reset tar buffer pointer and tar file counter */
- tp=0; ntarf=0;
+ /* reset tar buffer pointer and tar file counter and total dumped */
+ tp=0; ntarf=0; ttarf=0;
}
/****************************************************************************
@@ -1078,6 +1078,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
if (finfo.size % TBLOCK)
dozerobuf(tarhandle, TBLOCK - (finfo.size % TBLOCK));
+ ttarf+=finfo.size + TBLOCK - (finfo.size % TBLOCK);
ntarf++;
}
@@ -1606,6 +1607,7 @@ int process_tar(char *inbuf, char *outbuf)
free(tarbuf);
DEBUG(0, ("tar: dumped %d tar files\n", ntarf));
+ DEBUG(0, ("Total bytes written: %d\n", ttarf));
break;
}
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h
index ae59f95252..8482fa8d2c 100644
--- a/source3/include/nameserv.h
+++ b/source3/include/nameserv.h
@@ -117,7 +117,6 @@ enum state_type
NAME_REGISTER,
NAME_RELEASE,
NAME_QUERY_CONFIRM,
- NAME_QUERY_ANNOUNCE_HOST,
NAME_QUERY_SYNC_LOCAL,
NAME_QUERY_SYNC_REMOTE,
NAME_QUERY_DOM_SRV_CHK,
diff --git a/source3/nameannounce.c b/source3/nameannounce.c
index 6d87cb3416..a8fdde19bb 100644
--- a/source3/nameannounce.c
+++ b/source3/nameannounce.c
@@ -222,79 +222,50 @@ void announce_server(struct subnet_record *d, struct work_record *work,
*/
uint32 domain_type = SV_TYPE_DOMAIN_ENUM|SV_TYPE_NT;
BOOL wins_iface = ip_equal(d->bcast_ip, wins_ip);
-
- if (wins_iface && server_type != 0)
- {
- /* wins pseudo-ip interface */
- if (!AM_MASTER(work))
- {
- /* non-master announce by unicast to the domain
- master */
- if (!lp_wins_support() && *lp_wins_server())
- {
- /* look up the domain master with the WINS server */
- queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,
- NAME_QUERY_ANNOUNCE_HOST,
- work->work_group,0x1b,0,ttl*1000,
- server_type,name,comment,
- False, True, ipzero, d->bcast_ip);
- }
- else
- {
- /* we are the WINS server, but not the domain master. */
- /* XXXX we need to look up the domain master in our
- WINS database list, and do_announce_host(). maybe
- we could do a name query on the unsuspecting domain
- master just to make sure it's awake. */
- }
- }
- /* XXXX any other kinds of announcements we need to consider here?
- e.g local master browsers... no. local master browsers do
- local master announcements to their domain master. they even
- use WINS lookup of the domain master if another wins server
- is being used!
- */
- }
- else
+ if(wins_iface)
+ {
+ DEBUG(0,("announce_server: error - announcement requested on WINS \
+interface for workgroup %s, name %s\n", work->work_group, name));
+ return;
+ }
+
+ if (AM_MASTER(work))
{
- if (AM_MASTER(work))
- {
- DEBUG(3,("sending local master announce to %s for %s(1e)\n",
- inet_ntoa(d->bcast_ip),work->work_group));
+ DEBUG(3,("sending local master announce to %s for %s(1e)\n",
+ inet_ntoa(d->bcast_ip),work->work_group));
- do_announce_host(ANN_LocalMasterAnnouncement,
- name , 0x00, d->myip,
- work->work_group, 0x1e, d->bcast_ip,
- ttl,
- name, server_type, comment);
+ do_announce_host(ANN_LocalMasterAnnouncement,
+ name , 0x00, d->myip,
+ work->work_group, 0x1e, d->bcast_ip,
+ ttl,
+ name, server_type, comment);
- DEBUG(3,("sending domain announce to %s for %s\n",
- inet_ntoa(d->bcast_ip),work->work_group));
+ DEBUG(3,("sending domain announce to %s for %s\n",
+ inet_ntoa(d->bcast_ip),work->work_group));
- /* XXXX should we do a domain-announce-kill? */
- if (server_type != 0)
- {
- do_announce_host(ANN_DomainAnnouncement,
- name , 0x00, d->myip,
- MSBROWSE, 0x01, d->bcast_ip,
- ttl,
- work->work_group, server_type ? domain_type : 0,
- name);
- }
- }
- else
+ /* XXXX should we do a domain-announce-kill? */
+ if (server_type != 0)
{
- DEBUG(3,("sending host announce to %s for %s(1d)\n",
- inet_ntoa(d->bcast_ip),work->work_group));
-
- do_announce_host(ANN_HostAnnouncement,
- name , 0x00, d->myip,
- work->work_group, 0x1d, d->bcast_ip,
- ttl,
- name, server_type, comment);
+ do_announce_host(ANN_DomainAnnouncement,
+ name , 0x00, d->myip,
+ MSBROWSE, 0x01, d->bcast_ip,
+ ttl,
+ work->work_group, server_type ? domain_type : 0,
+ name);
}
}
+ else
+ {
+ DEBUG(3,("sending host announce to %s for %s(1d)\n",
+ inet_ntoa(d->bcast_ip),work->work_group));
+
+ do_announce_host(ANN_HostAnnouncement,
+ name , 0x00, d->myip,
+ work->work_group, 0x1d, d->bcast_ip,
+ ttl,
+ name, server_type, comment);
+ }
}
/****************************************************************************
@@ -435,24 +406,6 @@ workgroup %s\n", am_master, work->work_group));
char *name;
int type;
-#if 0 /* I don't think this option should be used for this purpose.
- JRA.
- */
- if (*lp_domain_controller())
- {
- /* the domain controller option is used to manually specify
- the domain master browser to sync with
- */
-
- /* XXXX i'm not sure we should be using the domain controller
- option for this purpose.
- */
-
- name = lp_domain_controller();
- type = 0x20;
- }
- else
-#endif /* REMOVE SUSPECT CODE. */
{
/* assume that the domain master browser we want to sync
with is our own domain.
diff --git a/source3/nameelect.c b/source3/nameelect.c
index 295fcd7333..e80bceb480 100644
--- a/source3/nameelect.c
+++ b/source3/nameelect.c
@@ -776,7 +776,7 @@ void process_election(struct packet_struct *p,char *buf)
if (ip_equal(d->bcast_ip,wins_ip))
{
- DEBUG(3,("Unexpected election request from %s %s on WINS net\n",
+ DEBUG(0,("Unexpected election request from %s %s on WINS net\n",
name, inet_ntoa(p->ip)));
return;
}
diff --git a/source3/nameservresp.c b/source3/nameservresp.c
index 226a997c5f..43548265a0 100644
--- a/source3/nameservresp.c
+++ b/source3/nameservresp.c
@@ -138,66 +138,6 @@ static void response_name_reg(struct nmb_name *ans_name,
}
}
-
-/****************************************************************************
- response from a name query announce host
- NAME_QUERY_ANNOUNCE_HOST is dealt with here
- ****************************************************************************/
-static void response_announce_host(struct nmb_name *ans_name,
- struct nmb_packet *nmb,
- struct response_record *n, struct subnet_record *d)
-{
- DEBUG(4, ("Name query at %s ip %s - ",
- namestr(&n->name), inet_ntoa(n->send_ip)));
-
- if (!name_equal(&n->name, ans_name))
- {
- /* someone gave us the wrong name as a reply. oops. */
- /* XXXX should say to them 'oi! release that name!' */
-
- DEBUG(4,("unexpected name received: %s\n", namestr(ans_name)));
- return;
- }
-
- if (nmb->header.rcode == 0 && nmb->answers->rdata)
- {
- /* we had sent out a name query to the current owner
- of a name because someone else wanted it. now they
- have responded saying that they still want the name,
- so the other host can't have it.
- */
-
- /* first check all the details are correct */
-
- int nb_flags = nmb->answers->rdata[0];
- struct in_addr found_ip;
-
- putip((char*)&found_ip,&nmb->answers->rdata[2]);
-
- if (nb_flags != n->nb_flags)
- {
- /* someone gave us the wrong nb_flags as a reply. oops. */
- /* XXXX should say to them 'oi! release that name!' */
-
- DEBUG(4,("expected nb_flags: %d\n", n->nb_flags));
- DEBUG(4,("unexpected nb_flags: %d\n", nb_flags));
- return;
- }
-
- /* do an announce host */
- do_announce_host(ANN_HostAnnouncement,
- n->my_name , 0x00, d->myip,
- n->name.name, 0x1d, found_ip,
- n->ttl,
- n->my_name, n->server_type, n->my_comment);
- }
- else
- {
- /* XXXX negative name query response. no master exists. oops */
- }
-}
-
-
/****************************************************************************
response from a name query server check. states of type NAME_QUERY_DOM_SRV_CHK,
NAME_QUERY_SRV_CHK, and NAME_QUERY_FIND_MST dealt with here.
@@ -268,25 +208,6 @@ static BOOL interpret_node_status(struct subnet_record *d,
if (NAME_ACTIVE (nb_flags)) { strcat(flags,"<ACTIVE> "); add=True; }
if (NAME_PERMANENT(nb_flags)) { strcat(flags,"<PERMANENT> "); add=True;}
-/* I don't think we should be messing with our namelist here... JRA */
-#if 0
- /* might as well update our namelist while we're at it */
- if (add)
- {
- struct in_addr nameip;
- enum name_source src;
-
- if (ismyip(ip)) {
- nameip = ipzero;
- src = SELF;
- } else {
- nameip = ip;
- src = STATUS_QUERY;
- }
- add_netbios_entry(d,qname,type,nb_flags,2*60*60,src,nameip,True,bcast);
- }
-#endif /* JRA */
-
/* we want the server name */
if (serv_name && !*serv_name && !group && type == 0x20)
{
@@ -586,7 +507,7 @@ void debug_state_type(int state)
case NAME_QUERY_CONFIRM : DEBUG(4,("NAME_QUERY_CONFIRM\n")); break;
case NAME_QUERY_SYNC_LOCAL : DEBUG(4,("NAME_QUERY_SYNC_LOCAL\n")); break;
case NAME_QUERY_SYNC_REMOTE : DEBUG(4,("NAME_QUERY_SYNC_REMOTE\n")); break;
- case NAME_QUERY_ANNOUNCE_HOST: DEBUG(4,("NAME_QUERY_ANNCE_HOST\n"));break;
+/* case NAME_QUERY_ANNOUNCE_HOST: DEBUG(4,("NAME_QUERY_ANNCE_HOST\n"));break; */
case NAME_QUERY_DOMAIN : DEBUG(4,("NAME_QUERY_DOMAIN\n")); break;
case NAME_REGISTER : DEBUG(4,("NAME_REGISTER\n")); break;
@@ -664,7 +585,7 @@ static BOOL response_problem_check(struct response_record *n,
lots of responses */
return False;
}
- case NAME_QUERY_ANNOUNCE_HOST:
+/* case NAME_QUERY_ANNOUNCE_HOST: */
case NAME_QUERY_DOM_SRV_CHK:
case NAME_QUERY_SRV_CHK:
case NAME_QUERY_MST_CHK:
@@ -733,7 +654,7 @@ static BOOL response_compatible(struct response_record *n,
case NAME_REGISTER_CHALLENGE: /* this is a query: we then do a register */
case NAME_QUERY_CONFIRM:
- case NAME_QUERY_ANNOUNCE_HOST:
+/* case NAME_QUERY_ANNOUNCE_HOST: */
case NAME_QUERY_SYNC_LOCAL:
case NAME_QUERY_SYNC_REMOTE:
case NAME_QUERY_DOM_SRV_CHK:
@@ -813,12 +734,6 @@ static void response_process(struct subnet_record *d, struct packet_struct *p,
break;
}
- case NAME_QUERY_ANNOUNCE_HOST:
- {
- response_announce_host(ans_name, nmb, n, d);
- break;
- }
-
case NAME_QUERY_CONFIRM:
case NAME_QUERY_SYNC_LOCAL:
case NAME_QUERY_SYNC_REMOTE:
diff --git a/source3/namework.c b/source3/namework.c
index ff623e69db..97934412e4 100644
--- a/source3/namework.c
+++ b/source3/namework.c
@@ -263,16 +263,6 @@ static void process_localnet_announce(struct packet_struct *p,uint16 command,cha
disabling it */
tell_become_backup();
#endif
-
-#if 0 /* JRA TEST - I Think this code should not be here */
- /* get the local_only browse list from the local master and add it
- to ours. */
- if (command == ANN_LocalMasterAnnouncement)
- {
- add_browser_entry(serv_name,dgram->dest_name.name_type,
- work->work_group,30,p->ip,True);
- }
-#endif /* END JRA TEST */
}
/*******************************************************************
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index eb837c2584..23c29104e3 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -237,13 +237,15 @@ uint16 register_vuid(int uid,int gid, char *name,BOOL guest)
vuser->real_name = Realloc(vuser->real_name, 15);
strcpy(vuser->real_name, "<Full Name>\0");
if (lp_unix_realname()) {
- pwfile=getpwnam(vuser->name);
- DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos));
- real_name_len = strcspn(pwfile->pw_gecos, ",");
- DEBUG(3, ("Real name length: %d\n", real_name_len));
- vuser->real_name = (char *)Realloc(vuser->real_name, real_name_len+1);
- strncpy(vuser->real_name, pwfile->pw_gecos, real_name_len);
- vuser->real_name[real_name_len]='\0';
+ if((pwfile=getpwnam(vuser->name))!= NULL)
+ {
+ DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos));
+ real_name_len = strcspn(pwfile->pw_gecos, ",");
+ DEBUG(3, ("Real name length: %d\n", real_name_len));
+ vuser->real_name = (char *)Realloc(vuser->real_name, real_name_len+1);
+ strncpy(vuser->real_name, pwfile->pw_gecos, real_name_len);
+ vuser->real_name[real_name_len]='\0';
+ }
}
return (uint16)((num_validated_users - 1) + VUID_OFFSET);