summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c12
-rw-r--r--source3/client/clientutil.c34
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/lib/time.c11
-rw-r--r--source3/lib/util.c9
-rw-r--r--source3/libsmb/clientgen.c10
-rw-r--r--source3/libsmb/namequery.c263
-rw-r--r--source3/nmbd/nmbd.c3
-rw-r--r--source3/nmbd/nmbd_lmhosts.c81
-rw-r--r--source3/param/loadparm.c19
-rw-r--r--source3/smbd/password.c9
-rw-r--r--source3/smbd/reply.c2
-rw-r--r--source3/smbd/trans2.c12
13 files changed, 343 insertions, 131 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index da44f344dd..679114fa2b 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3500,6 +3500,7 @@ static void usage(char *pname)
DEBUG(0,("\t-m max protocol set the max protocol level\n"));
DEBUG(0,("\t-L host get a list of shares available on a host\n"));
DEBUG(0,("\t-I dest IP use this IP to connect to\n"));
+ DEBUG(0,("\t-R name resolve order use these name resolution services only\n"));
DEBUG(0,("\t-E write messages to stderr instead of stdout\n"));
DEBUG(0,("\t-U username set the network username\n"));
DEBUG(0,("\t-W workgroup set the workgroup name\n"));
@@ -3528,6 +3529,7 @@ static void usage(char *pname)
extern char tar_type;
static pstring servicesf = CONFIGFILE;
pstring term_code;
+ pstring new_name_resolve_order;
char *p;
#ifdef KANJI
@@ -3539,6 +3541,8 @@ static void usage(char *pname)
*query_host = 0;
*base_directory = 0;
+ *new_name_resolve_order = 0;
+
DEBUGLEVEL = 2;
setup_logging(pname,True);
@@ -3624,7 +3628,7 @@ static void usage(char *pname)
}
while ((opt =
- getopt(argc, argv,"s:B:O:M:S:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
+ getopt(argc, argv,"s:B:O:R:M:S:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
switch (opt)
{
case 'm':
@@ -3633,6 +3637,9 @@ static void usage(char *pname)
case 'O':
strcpy(user_socket_options,optarg);
break;
+ case 'R':
+ pstrcpy(new_name_resolve_order, optarg);
+ break;
case 'S':
strcpy(desthost,optarg);
strupper(desthost);
@@ -3760,6 +3767,9 @@ static void usage(char *pname)
get_myname((*myname)?NULL:myname,NULL);
strupper(myname);
+ if(*new_name_resolve_order)
+ lp_set_name_resolve_order(new_name_resolve_order);
+
if (tar_type) {
recurse=True;
diff --git a/source3/client/clientutil.c b/source3/client/clientutil.c
index 8d5e11e4d8..2afac354c2 100644
--- a/source3/client/clientutil.c
+++ b/source3/client/clientutil.c
@@ -29,8 +29,6 @@
#define REGISTER 0
#endif
-#define USENMB
-
pstring service="";
pstring desthost="";
extern pstring myname;
@@ -863,7 +861,6 @@ BOOL cli_open_sockets(int port )
char *host;
pstring service2;
extern int Client;
- BOOL failed = True;
if (port == 0) port=last_port;
last_port=port;
@@ -894,37 +891,10 @@ BOOL cli_open_sockets(int port )
if (!have_ip)
{
- struct hostent *hp;
-
- if ((hp = Get_Hostbyname(host)))
- {
- putip((char *)&dest_ip,(char *)hp->h_addr);
- failed = False;
- }
- else
+ if(!resolve_name( host, &dest_ip))
{
-#ifdef USENMB
- /* Try and resolve the name with the netbios server */
- int bcast, count;
- struct in_addr *ip_list;
-
- if ((bcast = open_socket_in(SOCK_DGRAM, 0, 3,
- interpret_addr(lp_socket_address()))) != -1) {
- set_socket_options(bcast, "SO_BROADCAST");
-
- if ((ip_list = name_query(bcast, host, name_type, True, True, *iface_bcast(dest_ip),
- &count,0)) != NULL) {
- dest_ip = ip_list[0];
- free(ip_list);
- failed = False;
- }
- close (bcast);
- }
-#endif
- if (failed) {
- DEBUG(0,("Get_Hostbyname: Unknown host %s.\n",host));
+ DEBUG(0,("cli_open_sockets: Unknown host %s.\n",host));
return False;
- }
}
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9046fc2886..03fc3d6317 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -868,6 +868,7 @@ char *lp_auto_services(void);
char *lp_passwd_program(void);
char *lp_passwd_chat(void);
char *lp_passwordserver(void);
+char *lp_name_resolve_order(void);
char *lp_workgroup(void);
char *lp_username_map(void);
char *lp_character_set(void);
@@ -1007,6 +1008,7 @@ BOOL lp_fake_oplocks(int );
BOOL lp_recursive_veto_delete(int );
BOOL lp_dos_filetimes(int );
BOOL lp_dos_filetime_resolution(int );
+BOOL lp_fake_dir_create_times(int );
int lp_create_mode(int );
int lp_force_create_mode(int );
int lp_dir_mode(int );
@@ -1038,6 +1040,7 @@ void lp_copy_service(int snum, char *new_name);
int lp_default_server_announce(void);
int lp_major_announce_version(void);
int lp_minor_announce_version(void);
+void lp_set_name_resolve_order(char *new_order);
/*The following definitions come from locking.c */
@@ -1126,6 +1129,10 @@ BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
struct in_addr *name_query(int fd,char *name,int name_type,
BOOL bcast,BOOL recurse,
struct in_addr to_ip, int *count, void (*fn)());
+FILE *startlmhosts(char *fname);
+BOOL getlmhostsent( FILE *fp, char *name, int *name_type, struct in_addr *ipaddr);
+void endlmhosts(FILE *fp);
+BOOL resolve_name(char *name, struct in_addr *return_ip);
/*The following definitions come from nmbd.c */
@@ -1725,7 +1732,7 @@ time_t make_unix_date2(void *date_ptr);
time_t make_unix_date3(void *date_ptr);
char *http_timestring(time_t t);
char *timestring(void );
-time_t get_create_time(struct stat *st);
+time_t get_create_time(struct stat *st,BOOL fake_dirs);
/*The following definitions come from trans2.c */
diff --git a/source3/lib/time.c b/source3/lib/time.c
index c5584fd143..050b4725a7 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -500,10 +500,15 @@ char *timestring(void )
structure.
****************************************************************************/
-time_t get_create_time(struct stat *st)
+time_t get_create_time(struct stat *st,BOOL fake_dirs)
{
- time_t ret = MIN(st->st_ctime, st->st_mtime);
- time_t ret1 = MIN(ret, st->st_atime);
+ time_t ret, ret1;
+
+ if(S_ISDIR(st->st_mode) && fake_dirs)
+ return (time_t)315493200L; /* 1/1/1980 */
+
+ ret = MIN(st->st_ctime, st->st_mtime);
+ ret1 = MIN(ret, st->st_atime);
if(ret1 != (time_t)0)
return ret1;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 3bc96e1034..e9ece49170 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4047,11 +4047,20 @@ struct hostent *Get_Hostbyname(char *name)
exit(0);
}
+
+ /*
+ * This next test is redundent and causes some systems (with
+ * broken isalnum() calls) problems.
+ * JRA.
+ */
+
+#if 0
if (!isalnum(*name2))
{
free(name2);
return(NULL);
}
+#endif /* 0 */
ret = sys_gethostbyname(name2);
if (ret != NULL)
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 319a77beb6..4585c8a544 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -1343,13 +1343,9 @@ BOOL cli_connect(struct cli_state *cli, char *host, struct in_addr *ip)
fstrcpy(cli->desthost, host);
if (!ip) {
- struct hostent *hp;
-
- if ((hp = Get_Hostbyname(cli->desthost)) == 0) {
- return False;
- }
-
- putip((char *)&dest_ip,(char *)hp->h_addr);
+ if(!resolve_name( cli->desthost, &dest_ip)) {
+ return False;
+ }
} else {
dest_ip = *ip;
}
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 207f064670..6bf41b9f9e 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -25,6 +25,8 @@
extern pstring scope;
extern int DEBUGLEVEL;
+/* nmbd.c sets this to True. */
+BOOL global_in_nmbd = False;
/****************************************************************************
interpret a node status response
@@ -303,3 +305,264 @@ struct in_addr *name_query(int fd,char *name,int name_type,
return ip_list;
}
+
+/********************************************************
+ Start parsing the lmhosts file.
+*********************************************************/
+
+FILE *startlmhosts(char *fname)
+{
+ FILE *fp = fopen(fname,"r");
+ if (!fp) {
+ DEBUG(2,("startlmhosts: Can't open lmhosts file %s. Error was %s\n",
+ fname, strerror(errno)));
+ return NULL;
+ }
+ return fp;
+}
+
+/********************************************************
+ Parse the next line in the lmhosts file.
+*********************************************************/
+
+BOOL getlmhostsent( FILE *fp, char *name, int *name_type, struct in_addr *ipaddr)
+{
+ pstring line;
+
+ while(!feof(fp) && !ferror(fp)) {
+ pstring ip,flags,extra;
+ char *ptr;
+ int count = 0;
+
+ *name_type = -1;
+
+ if (!fgets_slash(line,sizeof(pstring),fp))
+ continue;
+
+ if (*line == '#')
+ continue;
+
+ strcpy(ip,"");
+ strcpy(name,"");
+ strcpy(flags,"");
+
+ ptr = line;
+
+ if (next_token(&ptr,ip ,NULL))
+ ++count;
+ if (next_token(&ptr,name ,NULL))
+ ++count;
+ if (next_token(&ptr,flags,NULL))
+ ++count;
+ if (next_token(&ptr,extra,NULL))
+ ++count;
+
+ if (count <= 0)
+ continue;
+
+ if (count > 0 && count < 2)
+ {
+ DEBUG(0,("getlmhostsent: Ill formed hosts line [%s]\n",line));
+ continue;
+ }
+
+ if (count >= 4)
+ {
+ DEBUG(0,("getlmhostsent: too many columns in lmhosts file (obsolete syntax)\n"));
+ continue;
+ }
+
+ DEBUG(4, ("getlmhostsent: lmhost entry: %s %s %s\n", ip, name, flags));
+
+ if (strchr(flags,'G') || strchr(flags,'S'))
+ {
+ DEBUG(0,("getlmhostsent: group flag in lmhosts ignored (obsolete)\n"));
+ continue;
+ }
+
+ *ipaddr = *interpret_addr2(ip);
+
+ /* Extra feature. If the name ends in '#XX', where XX is a hex number,
+ then only add that name type. */
+ if((ptr = strchr(name, '#')) != NULL)
+ {
+ char *endptr;
+
+ ptr++;
+ *name_type = (int)strtol(ptr, &endptr,0);
+
+ if(!*ptr || (endptr == ptr))
+ {
+ DEBUG(0,("getlmhostsent: invalid name %s containing '#'.\n", name));
+ continue;
+ }
+
+ *(--ptr) = '\0'; /* Truncate at the '#' */
+ }
+
+ return True;
+ }
+
+ return False;
+}
+
+/********************************************************
+ Finish parsing the lmhosts file.
+*********************************************************/
+
+void endlmhosts(FILE *fp)
+{
+ fclose(fp);
+}
+
+/********************************************************
+ Resolve a name into an IP address. Use this function if
+ the string is either an IP address, DNS or host name
+ or NetBIOS name. This uses the name switch in the
+ smb.conf to determine the order of name resolution.
+*********************************************************/
+
+BOOL resolve_name(char *name, struct in_addr *return_ip)
+{
+ char *p;
+ int i;
+ BOOL pure_address = True;
+
+ if (strcmp(name,"0.0.0.0") == 0) {
+ return_ip->s_addr = 0;
+ return True;
+ }
+ if (strcmp(name,"255.255.255.255") == 0) {
+ return_ip->s_addr = 0xFFFFFFFF;
+ return True;
+ }
+
+ for (i=0; pure_address && name[i]; i++)
+ if (!(isdigit(name[i]) || name[i] == '.'))
+ pure_address = False;
+
+ /* if it's in the form of an IP address then get the lib to interpret it */
+ if (pure_address) {
+ return_ip->s_addr = inet_addr(name);
+ return True;
+ }
+
+ for (p=strtok(lp_name_resolve_order(),LIST_SEP); p; p = strtok(NULL,LIST_SEP)) {
+ if(strequal(p, "host") || strequal(p, "hosts")) {
+
+ /*
+ * "host" means do a localhost, or dns lookup.
+ */
+
+ struct hostent *hp;
+
+ DEBUG(3,("resolve_name: Attempting host lookup for name %s\n"));
+
+ if (((hp = Get_Hostbyname(name)) != NULL) && (hp->h_addr != NULL)) {
+ putip((char *)return_ip,(char *)hp->h_addr);
+ return True;
+ }
+
+ } else if(strequal( p, "lmhosts")) {
+
+ /*
+ * "lmhosts" means parse the local lmhosts file.
+ */
+
+ FILE *fp;
+ pstring lmhost_name;
+ int name_type;
+
+ DEBUG(3,("resolve_name: Attempting lmhosts lookup for name %s\n"));
+
+ fp = startlmhosts( LMHOSTSFILE );
+ if(fp) {
+ while( getlmhostsent(fp, lmhost_name, &name_type, return_ip ) ) {
+ if( strequal(name, lmhost_name )) {
+ endlmhosts(fp);
+ return True;
+ }
+ }
+ endlmhosts(fp);
+ }
+
+ } else if(strequal( p, "wins")) {
+
+ int sock;
+
+ /*
+ * "wins" means do a unicast lookup to the WINS server.
+ * Ignore if there is no WINS server specified or if the
+ * WINS server is one of our interfaces (if we're being
+ * called from within nmbd - we can't do this call as we
+ * would then block).
+ */
+
+ DEBUG(3,("resolve_name: Attempting wins lookup for name %s\n"));
+
+ if(*lp_wins_server()) {
+ struct in_addr wins_ip = *interpret_addr2(lp_wins_server());
+ BOOL wins_ismyip = ismyip(wins_ip);
+
+ if((wins_ismyip && !global_in_nmbd) || !wins_ismyip) {
+ sock = open_socket_in( SOCK_DGRAM, 0, 3,
+ interpret_addr(lp_socket_address()) );
+
+ if (sock != -1) {
+ struct in_addr *iplist = NULL;
+ int count;
+ iplist = name_query(sock, name, 0x20, False, True, wins_ip, &count, NULL);
+ if(iplist != NULL) {
+ *return_ip = iplist[0];
+ free((char *)iplist);
+ close(sock);
+ return True;
+ }
+ close(sock);
+ }
+ }
+ } else {
+ DEBUG(3,("resolve_name: WINS server resolution selected and no WINS server present.\n"));
+ }
+ } else if(strequal( p, "bcast")) {
+
+ int sock;
+
+ /*
+ * "bcast" means do a broadcast lookup on all the local interfaces.
+ */
+
+ DEBUG(3,("resolve_name: Attempting broadcast lookup for name %s\n"));
+
+ sock = open_socket_in( SOCK_DGRAM, 0, 3,
+ interpret_addr(lp_socket_address()) );
+
+ if (sock != -1) {
+ struct in_addr *iplist = NULL;
+ int count;
+ int num_interfaces = iface_count();
+ set_socket_options(sock,"SO_BROADCAST");
+ /*
+ * Lookup the name on all the interfaces, return on
+ * the first successful match.
+ */
+ for( i = 0; i < num_interfaces; i++) {
+ struct in_addr sendto_ip = *iface_bcast(*iface_n_ip(i));
+ iplist = name_query(sock, name, 0x20, True, False, sendto_ip, &count, NULL);
+ if(iplist != NULL) {
+ *return_ip = iplist[0];
+ free((char *)iplist);
+ close(sock);
+ return True;
+ }
+ }
+ close(sock);
+ }
+
+ } else {
+ DEBUG(0,("resolve_name: unknown name switch type %s\n", p));
+ }
+ }
+
+ return False;
+}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index e757aa46c4..837f98e8bb 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -44,6 +44,8 @@ extern pstring myname;
extern fstring myworkgroup;
extern char **my_netbios_names;
+extern BOOL global_in_nmbd;
+
/* are we running as a daemon ? */
static BOOL is_daemon = False;
@@ -552,6 +554,7 @@ int main(int argc,char *argv[])
global_nmb_port = NMB_PORT;
*host_file = 0;
+ global_in_nmbd = True;
StartupTime = time(NULL);
diff --git a/source3/nmbd/nmbd_lmhosts.c b/source3/nmbd/nmbd_lmhosts.c
index 722c3681f5..206c2367b1 100644
--- a/source3/nmbd/nmbd_lmhosts.c
+++ b/source3/nmbd/nmbd_lmhosts.c
@@ -33,88 +33,21 @@ Load a lmhosts file.
****************************************************************************/
void load_lmhosts_file(char *fname)
{
- FILE *fp = fopen(fname,"r");
- pstring line;
+ pstring name;
+ int name_type;
+ struct in_addr ipaddr;
+ FILE *fp = startlmhosts( fname );
+
if (!fp) {
DEBUG(2,("load_lmhosts_file: Can't open lmhosts file %s. Error was %s\n",
fname, strerror(errno)));
return;
}
- while (!feof(fp))
+ while (getlmhostsent(fp, name, &name_type, &ipaddr) )
{
- pstring ip,name,flags,extra;
struct subnet_record *subrec = NULL;
- char *ptr;
- int count = 0;
- struct in_addr ipaddr;
enum name_source source = LMHOSTS_NAME;
- int name_type = -1;
-
- if (!fgets_slash(line,sizeof(pstring),fp))
- continue;
-
- if (*line == '#')
- continue;
-
- strcpy(ip,"");
- strcpy(name,"");
- strcpy(flags,"");
-
- ptr = line;
-
- if (next_token(&ptr,ip ,NULL))
- ++count;
- if (next_token(&ptr,name ,NULL))
- ++count;
- if (next_token(&ptr,flags,NULL))
- ++count;
- if (next_token(&ptr,extra,NULL))
- ++count;
-
- if (count <= 0)
- continue;
-
- if (count > 0 && count < 2)
- {
- DEBUG(0,("load_lmhosts_file: Ill formed hosts line [%s]\n",line));
- continue;
- }
-
- if (count >= 4)
- {
- DEBUG(0,("load_lmhosts_file: too many columns in lmhosts file %s (obsolete syntax)\n",
- fname));
- continue;
- }
-
- DEBUG(4, ("load_lmhosts_file: lmhost entry: %s %s %s\n", ip, name, flags));
-
- if (strchr(flags,'G') || strchr(flags,'S'))
- {
- DEBUG(0,("load_lmhosts_file: group flag in %s ignored (obsolete)\n",fname));
- continue;
- }
-
- ipaddr = *interpret_addr2(ip);
-
- /* Extra feature. If the name ends in '#XX', where XX is a hex number,
- then only add that name type. */
- if((ptr = strchr(name, '#')) != NULL)
- {
- char *endptr;
-
- ptr++;
- name_type = (int)strtol(ptr, &endptr,0);
-
- if(!*ptr || (endptr == ptr))
- {
- DEBUG(0,("load_lmhosts_file: invalid name %s containing '#'.\n", name));
- continue;
- }
-
- *(--ptr) = '\0'; /* Truncate at the '#' */
- }
/* We find a relevent subnet to put this entry on, then add it. */
/* Go through all the broadcast subnets and see if the mask matches. */
@@ -141,7 +74,7 @@ void load_lmhosts_file(char *fname)
}
}
- fclose(fp);
+ endlmhosts(fp);
}
/****************************************************************************
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 52914ffd5d..1d65030869 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -143,6 +143,7 @@ typedef struct
char *szDomainOtherSIDs;
char *szDomainGroups;
char *szDriverFile;
+ char *szNameResolveOrder;
int max_log_size;
int mangled_stack;
int max_xmit;
@@ -281,6 +282,7 @@ typedef struct
BOOL bDeleteVetoFiles;
BOOL bDosFiletimes;
BOOL bDosFiletimeResolution;
+ BOOL bFakeDirCreateTimes;
char dummy[3]; /* for alignment */
} service;
@@ -368,6 +370,7 @@ static service sDefault =
False, /* bDeleteVetoFiles */
False, /* bDosFiletimes */
False, /* bDosFiletimeResolution */
+ False, /* bFakeDirCreateTimes */
"" /* dummy */
};
@@ -495,6 +498,7 @@ static struct parm_struct parm_table[] =
{"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as, 0},
{"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL, 0},
{"max xmit", P_INTEGER, P_GLOBAL, &Globals.max_xmit, NULL, NULL, 0},
+ {"name resolve order", P_STRING, P_GLOBAL, &Globals.szNameResolveOrder, NULL, NULL, 0},
{"max packet", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL, NULL, 0},
{"packet size", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL, NULL, 0},
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL, NULL, 0},
@@ -642,7 +646,8 @@ static struct parm_struct parm_table[] =
{"delete readonly", P_BOOL, P_LOCAL, &sDefault.bDeleteReadonly, NULL, NULL, FLAG_GLOBAL},
{"dos filetimes", P_BOOL, P_LOCAL, &sDefault.bDosFiletimes, NULL, NULL, FLAG_GLOBAL},
{"dos filetime resolution",P_BOOL,P_LOCAL,&sDefault.bDosFiletimeResolution, NULL, NULL, FLAG_GLOBAL},
-
+
+ {"fake directory create times", P_BOOL,P_LOCAL, &sDefault.bFakeDirCreateTimes, NULL, NULL, FLAG_GLOBAL},
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
};
@@ -696,6 +701,8 @@ static void init_globals(void)
string_set(&Globals.szLogonHome, "\\\\%N\\%U");
string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
+ string_set(&Globals.szNameResolveOrder, "lmhosts host wins bcast");
+
Globals.bLoadPrinters = True;
Globals.bUseRhosts = False;
Globals.max_packet = 65535;
@@ -906,6 +913,7 @@ FN_GLOBAL_STRING(lp_auto_services,&Globals.szAutoServices)
FN_GLOBAL_STRING(lp_passwd_program,&Globals.szPasswdProgram)
FN_GLOBAL_STRING(lp_passwd_chat,&Globals.szPasswdChat)
FN_GLOBAL_STRING(lp_passwordserver,&Globals.szPasswordServer)
+FN_GLOBAL_STRING(lp_name_resolve_order,&Globals.szNameResolveOrder)
FN_GLOBAL_STRING(lp_workgroup,&Globals.szWorkGroup)
FN_GLOBAL_STRING(lp_username_map,&Globals.szUsernameMap)
FN_GLOBAL_STRING(lp_character_set,&Globals.szCharacterSet)
@@ -1050,6 +1058,7 @@ FN_LOCAL_BOOL(lp_fake_oplocks,bFakeOplocks)
FN_LOCAL_BOOL(lp_recursive_veto_delete,bDeleteVetoFiles)
FN_LOCAL_BOOL(lp_dos_filetimes,bDosFiletimes)
FN_LOCAL_BOOL(lp_dos_filetime_resolution,bDosFiletimeResolution)
+FN_LOCAL_BOOL(lp_fake_dir_create_times,bFakeDirCreateTimes)
FN_LOCAL_INTEGER(lp_create_mode,iCreate_mask)
FN_LOCAL_INTEGER(lp_force_create_mode,iCreate_force_mode)
@@ -2478,3 +2487,11 @@ int lp_minor_announce_version(void)
return minor_version;
}
+/***********************************************************
+ Set the global name resolution order (used in smbclient).
+************************************************************/
+
+void lp_set_name_resolve_order(char *new_order)
+{
+ Globals.szNameResolveOrder = new_order;
+}
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index c0e89100ea..bb0aacac7e 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -1689,11 +1689,10 @@ struct cli_state *server_cryptkey(void)
standard_sub_basic(desthost);
strupper(desthost);
- dest_ip = *interpret_addr2(desthost);
- if (zero_ip(dest_ip)) {
- DEBUG(1,("Can't resolve address for %s\n",p));
- continue;
- }
+ if(!resolve_name( desthost, &dest_ip)) {
+ DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",p));
+ continue;
+ }
if (ismyip(dest_ip)) {
DEBUG(1,("Password server loop - disabling password server %s\n",p));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index b0550bba57..4d163d70a0 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3965,7 +3965,7 @@ int reply_getattrE(char *inbuf,char *outbuf)
/* Convert the times into dos times. Set create
date to be last modify date as UNIX doesn't save
this */
- put_dos_date2(outbuf,smb_vwv0,get_create_time(&sbuf));
+ put_dos_date2(outbuf,smb_vwv0,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum))));
put_dos_date2(outbuf,smb_vwv2,sbuf.st_atime);
put_dos_date2(outbuf,smb_vwv4,sbuf.st_mtime);
if (mode & aDIR)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 3cd6c138c8..165df56af5 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -385,7 +385,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
size = sbuf.st_size;
mdate = sbuf.st_mtime;
adate = sbuf.st_atime;
- cdate = get_create_time(&sbuf);
+ cdate = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum)));
if(mode & aDIR)
size = 0;
@@ -1204,7 +1204,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
case SMB_INFO_STANDARD:
case SMB_INFO_QUERY_EA_SIZE:
data_size = (info_level==1?22:26);
- put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf));
+ put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum))));
put_dos_date2(pdata,l1_fdateLastAccess,sbuf.st_atime);
put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */
SIVAL(pdata,l1_cbFile,size);
@@ -1215,7 +1215,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
case SMB_INFO_QUERY_EAS_FROM_LIST:
data_size = 24;
- put_dos_date2(pdata,0,get_create_time(&sbuf));
+ put_dos_date2(pdata,0,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum))));
put_dos_date2(pdata,4,sbuf.st_atime);
put_dos_date2(pdata,8,sbuf.st_mtime);
SIVAL(pdata,12,size);
@@ -1233,7 +1233,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
case SMB_QUERY_FILE_BASIC_INFO:
data_size = 36; /* w95 returns 40 bytes not 36 - why ?. */
- put_long_date(pdata,get_create_time(&sbuf));
+ put_long_date(pdata,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum))));
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */
put_long_date(pdata+24,sbuf.st_mtime); /* change time */
@@ -1241,7 +1241,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
DEBUG(5,("SMB_QFBI - "));
{
- time_t create_time = get_create_time(&sbuf);
+ time_t create_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum)));
DEBUG(5,("create: %s ", ctime(&create_time)));
}
DEBUG(5,("access: %s ", ctime(&sbuf.st_atime)));
@@ -1297,7 +1297,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
break;
case SMB_QUERY_FILE_ALL_INFO:
- put_long_date(pdata,get_create_time(&sbuf));
+ put_long_date(pdata,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum))));
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */
put_long_date(pdata+24,sbuf.st_mtime); /* change time */