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;
int put_total_size = 0;
int put_total_time_ms = 0;
+/* totals globals */
+int dir_total = 0;
extern int Client;
****************************************************************************/
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;
+ }
}
fstring buf;
char *p=buf;
+ dir_total = 0;
strcpy(mask,cur_dir);
if(mask[strlen(mask)-1]!='\\')
strcat(mask,"\\");
do_dir(inbuf,outbuf,mask,attribute,NULL,recurse);
do_dskattr();
+
+ DEBUG(3, ("Total bytes listed: %d\n", dir_total));
}
#endif
static char *tarbuf;
-static int tp, ntarf, tbufsiz;
+static int tp, ntarf, tbufsiz, ttarf;
/* Incremental mode */
BOOL tar_inc=False;
/* Reset archive bit */
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;
}
/****************************************************************************
if (finfo.size % TBLOCK)
dozerobuf(tarhandle, TBLOCK - (finfo.size % TBLOCK));
+ ttarf+=finfo.size + TBLOCK - (finfo.size % TBLOCK);
ntarf++;
}
free(tarbuf);
DEBUG(0, ("tar: dumped %d tar files\n", ntarf));
+ DEBUG(0, ("Total bytes written: %d\n", ttarf));
break;
}
NAME_REGISTER,
NAME_RELEASE,
NAME_QUERY_CONFIRM,
- NAME_QUERY_ANNOUNCE_HOST,
NAME_QUERY_SYNC_LOCAL,
NAME_QUERY_SYNC_REMOTE,
NAME_QUERY_DOM_SRV_CHK,
*/
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);
+ }
}
/****************************************************************************
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.
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;
}
}
}
-
-/****************************************************************************
- 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.
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)
{
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;
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:
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:
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:
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 */
}
/*******************************************************************
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);