}
ret = reduce_name(name,Connections[cnum].connectpath,lp_widelinks(SNUM(cnum)));
+
+ /* Check if we are allowing users to follow symlinks */
+ /* Patch from David Clerc <David.Clerc@cui.unige.ch>
+ University of Geneva */
+
+ if (!lp_symlinks(SNUM(cnum)))
+ {
+ struct stat statbuf;
+ if ( (sys_lstat(name,&statbuf) != -1) &&
+ (S_ISLNK(statbuf.st_mode)) )
+ {
+ DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name));
+ ret=0;
+ }
+ }
+
if (!ret)
DEBUG(5,("check_name on %s failed\n",name));
int old_open_mode = old_shares[i].share_mode &0xF;
int old_deny_mode = (old_shares[i].share_mode >>4)&7;
- if (deny_mode > 4 || old_deny_mode > 4 || old_open_mode > 2)
+ if (old_deny_mode > 4 || old_open_mode > 2)
{
- DEBUG(2,("Invalid share mode (%d,%d,%d) on file %s\n",
+ DEBUG(0,("Invalid share mode found (%d,%d,%d) on file %s\n",
deny_mode,old_deny_mode,old_open_mode,fname));
free((char *)old_shares);
if(share_locked)
int deadtime = lp_deadtime()*60;
int counter;
int last_keepalive=0;
+ int service_load_counter = 0;
if (deadtime <= 0)
deadtime = DEFAULT_SMBD_TIMEOUT;
BOOL allidle = True;
extern int keepalive;
+ if (counter > 365 * 3600) /* big number of seconds. */
+ {
+ counter = 0;
+ service_load_counter = 0;
+ }
+
if (smb_read_error == READ_EOF) {
DEBUG(3,("end of file from client\n"));
return;
unbecome_user();
/* check for smb.conf reload */
- if (!(counter%SMBD_RELOAD_CHECK))
- reload_services(True);
+ if (counter >= service_load_counter + SMBD_RELOAD_CHECK)
+ {
+ service_load_counter = counter;
-#if 0 /* JRA */
- /* check the share modes every 10 secs */
- if (!(counter%SHARE_MODES_CHECK))
- check_share_modes();
+ /* remove all unused services. reduce some of that memory overhead. */
+ lp_killunused(snum_used);
- /* clean the share modes every 5 minutes */
- if (!(counter%SHARE_MODES_CLEAN))
- clean_share_modes();
-#endif /* JRA */
+ /* reload services, if files have changed. */
+ reload_services(True);
+ }
/* automatic timeout if all connections are closed */
if (num_connections_open==0 && counter >= IDLE_CLOSED_TIMEOUT) {
setup_logging(argv[0],False);
- charset_initialise(-1);
+ charset_initialise();
/* make absolutely sure we run as root - to handle cases whre people
are crazy enough to have it setuid */
if (!reload_services(False))
return(-1);
- charset_initialise(lp_client_code_page());
+ codepage_initialise(lp_client_code_page());
strcpy(myworkgroup, lp_workgroup());