[Samba] disabling offline caching from samba

Shirish Kalele kalele at veritas.com
Thu Apr 4 15:12:02 GMT 2002


Brad,

Here's a patch (against 2.2.3a) that will let you set a per-share
server-side policy for client-side offline caching. Setting "csc policy =
disable" will disable csc on your roaming profiles shares. The default is
"manual".

This patch will probably be in the next Samba release.

Cheers,
Shirish

diff -ur source.orig/param/loadparm.c source/param/loadparm.c
--- source.orig/param/loadparm.c Mon Apr  1 18:20:03 2002
+++ source/param/loadparm.c Thu Apr  4 14:32:29 2002
@@ -351,6 +351,7 @@
  int iDefaultCase;
  int iPrinting;
  int iOplockContentionLimit;
+ int iCSCPolicy;
  BOOL bAlternatePerm;
  BOOL bPreexecClose;
  BOOL bRootpreexecClose;
@@ -468,6 +469,7 @@
  CASE_LOWER,  /* iDefaultCase */
  DEFAULT_PRINTING, /* iPrinting */
  2,   /* iOplockContentionLimit */
+ 0,                      /* iCSCPolicy */
  False,   /* bAlternatePerm */
  False,   /* bPreexecClose */
  False,   /* bRootpreexecClose */
@@ -637,6 +639,19 @@
  {-1, NULL}
 };

+   /* Client-side offline caching policy types */
+#define CSC_POLICY_MANUAL 0
+#define CSC_POLICY_DOCUMENTS 1
+#define CSC_POLICY_PROGRAMS 2
+#define CSC_POLICY_DISABLE 3
+
+static struct enum_list enum_csc_policy[] = {
+ {CSC_POLICY_MANUAL, "manual"},
+ {CSC_POLICY_DOCUMENTS, "documents"},
+ {CSC_POLICY_PROGRAMS, "programs"},
+ {CSC_POLICY_DISABLE, "disable"}
+};
+
 /*
    Do you want session setups at user level security with a invalid
    password to be rejected or allowed in as guest? WinNT rejects them
@@ -972,6 +987,7 @@
  {"level2 oplocks", P_BOOL, P_LOCAL, &sDefault.bLevel2OpLocks, NULL, NULL,
FLAG_SHARE | FLAG_GLOBAL},
  {"oplock break wait time", P_INTEGER, P_GLOBAL,
&Globals.oplock_break_wait_time, NULL, NULL, FLAG_GLOBAL},
  {"oplock contention limit", P_INTEGER, P_LOCAL,
&sDefault.iOplockContentionLimit, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL},
+ {"csc policy", P_ENUM, P_LOCAL, &sDefault.iCSCPolicy, NULL,
enum_csc_policy, FLAG_SHARE | FLAG_GLOBAL},
  {"posix locking", P_BOOL, P_LOCAL, &sDefault.bPosixLocking, NULL, NULL,
FLAG_SHARE | FLAG_GLOBAL},
  {"strict locking", P_BOOL, P_LOCAL, &sDefault.bStrictLocking, NULL, NULL,
FLAG_SHARE | FLAG_GLOBAL},
  {"share modes", P_BOOL, P_LOCAL,  &sDefault.bShareModes, NULL, NULL,
FLAG_SHARE|FLAG_GLOBAL},
@@ -1731,6 +1747,7 @@
 FN_LOCAL_INTEGER(lp_maxprintjobs, iMaxPrintJobs)
 FN_LOCAL_INTEGER(lp_printing, iPrinting)
 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
+FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
 FN_LOCAL_CHAR(lp_magicchar, magic_char)
 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
diff -ur source.orig/smbd/reply.c source/smbd/reply.c
--- source.orig/smbd/reply.c Mon Apr  1 18:20:07 2002
+++ source/smbd/reply.c Thu Apr  4 14:50:01 2002
@@ -385,7 +385,8 @@

   /* what does setting this bit do? It is set by NT4 and
      may affect the ability to autorun mounted cdroms */
-  SSVAL(outbuf, smb_vwv2, SMB_SUPPORT_SEARCH_BITS);
+  SSVAL(outbuf, smb_vwv2, SMB_SUPPORT_SEARCH_BITS |
+        (lp_csc_policy(SNUM(conn)) << 2));

   init_dfsroot(conn, inbuf, outbuf);
  }

-----Original Message-----
Subject:  [Samba] how to disable offline caching on the server
From:     "Bradley W. Langhorst" <bwlang at unh.edu>
Date:     2002-03-20 20:53:17

I've just read
http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q287566
which states

To work around this behavior, create a separate share to store the
users' profiles, and then disable the cache option on that share. (The
cache option can only be disabled on shares that are hosted by computers
that run Windows 2000.)

Is there really no way to disable offline caching from the server side?

brad





More information about the samba mailing list