📄 fhs.patch
字号:
diff -uNr samba-3.0.10.orig/source/Makefile.in samba-3.0.10/source/Makefile.in--- samba-3.0.10.orig/source/Makefile.in 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/Makefile.in 2004-12-17 03:55:29.000000000 -0800@@ -90,6 +90,13 @@ # the directory where lock files go LOCKDIR = @lockdir@ +# FHS directories; equal to LOCKDIR if not using --with-fhs+CACHEDIR = @cachedir@+STATEDIR = @statedir@++# Where to look for (and install) codepage databases.+CODEPAGEDIR = @codepagedir@+ # the directory where pid files go PIDDIR = @piddir@ # man pages language(s)@@ -114,7 +121,7 @@ PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \ -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"-PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"+PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" -DCACHEDIR=\"$(CACHEDIR)\" -DSTATEDIR=\"$(STATEDIR)\" PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS) # Note that all executable programs now provide for an optional executable suffix.@@ -1319,7 +1326,7 @@ @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS) installdat: installdirs- @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(LIBDIR) $(srcdir)+ @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(CODEPAGEDIR) $(srcdir) installmsg: installdirs @$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(LIBDIR) $(srcdir)diff -uNr samba-3.0.10.orig/source/configure.in samba-3.0.10/source/configure.in--- samba-3.0.10.orig/source/configure.in 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/configure.in 2004-12-17 03:55:29.000000000 -0800@@ -35,7 +35,7 @@ [ --with-fhs Use FHS-compliant paths (default=no)], [ case "$withval" in yes)- lockdir="\${VARDIR}/lib/samba"+ lockdir="\${VARDIR}/run/samba" piddir="\${VARDIR}/run" mandir="\${prefix}/share/man" logfilebase="\${VARDIR}/log/samba"@@ -43,6 +43,10 @@ libdir="\${prefix}/lib/samba" configdir="${sysconfdir}/samba" swatdir="\${DATADIR}/samba/swat"+ codepagedir="\${DATADIR}/samba"+ statedir="\${VARDIR}/lib/samba"+ cachedir="\${VARDIR}/cache/samba"+ AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths]) ;; esac]) @@ -201,6 +205,9 @@ AC_SUBST(sbindir) AC_SUBST(rootsbindir) AC_SUBST(pammodulesdir)+AC_SUBST(codepagedir)+AC_SUBST(statedir)+AC_SUBST(cachedir) dnl Unique-to-Samba variables we'll be playing with. AC_SUBST(SHELL)diff -uNr samba-3.0.10.orig/source/dynconfig.c samba-3.0.10/source/dynconfig.c--- samba-3.0.10.orig/source/dynconfig.c 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/dynconfig.c 2004-12-17 03:55:29.000000000 -0800@@ -53,6 +53,13 @@ pstring dyn_LMHOSTSFILE = LMHOSTSFILE; /**+ * @brief Samba data directory.+ *+ * @sa data_path() to get the path to a file inside the CODEPAGEDIR.+ **/+pstring dyn_CODEPAGEDIR = CODEPAGEDIR;++/** * @brief Samba library directory. * * @sa lib_path() to get the path to a file inside the LIBDIR.@@ -70,3 +77,27 @@ pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE; pstring dyn_PRIVATE_DIR = PRIVATE_DIR;+++/* In non-FHS mode, these should be configurable using 'lock dir =';+ but in FHS mode, they are their own directory. Implement as wrapper+ functions so that everything can still be kept in dynconfig.c.+ */++char *dyn_STATEDIR(void)+{+#ifdef FHS_COMPATIBLE+ return STATEDIR;+#else+ return lp_lockdir();+#endif+}++char *dyn_CACHEDIR(void)+{+#ifdef FHS_COMPATIBLE+ return CACHEDIR;+#else+ return lp_lockdir();+#endif+}diff -uNr samba-3.0.10.orig/source/groupdb/mapping.c samba-3.0.10/source/groupdb/mapping.c--- samba-3.0.10.orig/source/groupdb/mapping.c 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/groupdb/mapping.c 2004-12-17 03:55:29.000000000 -0800@@ -140,8 +140,8 @@ if (tdb) return True; - tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);+ tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open group mapping database\n")); return False;diff -uNr samba-3.0.10.orig/source/include/dynconfig.h samba-3.0.10/source/include/dynconfig.h--- samba-3.0.10.orig/source/include/dynconfig.h 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/include/dynconfig.h 2004-12-17 03:55:29.000000000 -0800@@ -31,8 +31,12 @@ extern pstring dyn_CONFIGFILE; extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE; extern pstring dyn_LIBDIR;+extern pstring dyn_CODEPAGEDIR; extern fstring dyn_SHLIBEXT; extern pstring dyn_LOCKDIR; extern pstring dyn_PIDDIR; extern pstring dyn_SMB_PASSWD_FILE; extern pstring dyn_PRIVATE_DIR;++char *dyn_STATEDIR(void);+char *dyn_CACHEDIR(void);diff -uNr samba-3.0.10.orig/source/intl/lang_tdb.c samba-3.0.10/source/intl/lang_tdb.c--- samba-3.0.10.orig/source/intl/lang_tdb.c 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/intl/lang_tdb.c 2004-12-17 03:55:29.000000000 -0800@@ -128,7 +128,7 @@ if (!lang) return True; - asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));+ asprintf(&msg_path, "%s.msg", data_path((const char *)lang)); if (stat(msg_path, &st) != 0) { /* the msg file isn't available */ DEBUG(10, ("lang_tdb_init: %s: %s\n", msg_path, diff -uNr samba-3.0.21.orig/source/lib/account_pol.c samba-3.0.21/source/lib/account_pol.c--- samba-3.0.21.orig/source/lib/account_pol.c 2005-12-20 15:28:38.000000000 +0000+++ samba-3.0.21/source/lib/account_pol.c 2005-12-23 11:41:08.000000000 +0000@@ -262,7 +262,7 @@ return True; } - tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);+ tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open account policy database\n")); return False;diff -uNr samba-3.0.10.orig/source/lib/util.c samba-3.0.10/source/lib/util.c--- samba-3.0.10.orig/source/lib/util.c 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/lib/util.c 2004-12-17 03:55:29.000000000 -0800@@ -2362,6 +2362,61 @@ } /**+ * @brief Returns an absolute path to a file in the Samba data directory.+ *+ * @param name File to find, relative to CODEPAGEDIR.+ *+ * @retval Pointer to a static #pstring containing the full path.+ **/++char *data_path(const char *name)+{+ static pstring fname;+ snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);+ return fname;+}++/*****************************************************************+a useful function for returning a path in the Samba state directory+ *****************************************************************/+char *state_path(char *name)+{+ static pstring fname;++ pstrcpy(fname,dyn_STATEDIR());+ trim_string(fname,"","/");++ if (!directory_exist(fname,NULL)) {+ mkdir(fname,0755);+ }++ pstrcat(fname,"/");+ pstrcat(fname,name);++ return fname;+}++/*****************************************************************+a useful function for returning a path in the Samba cache directory+ *****************************************************************/+char *cache_path(char *name)+{+ static pstring fname;++ pstrcpy(fname,dyn_CACHEDIR());+ trim_string(fname,"","/");++ if (!directory_exist(fname,NULL)) {+ mkdir(fname,0755);+ }++ pstrcat(fname,"/");+ pstrcat(fname,name);++ return fname;+}++/** * @brief Returns the platform specific shared library extension. * * @retval Pointer to a static #fstring containing the extension.diff -uNr samba-3.0.10.orig/source/lib/util_unistr.c samba-3.0.10/source/lib/util_unistr.c--- samba-3.0.10.orig/source/lib/util_unistr.c 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/lib/util_unistr.c 2004-12-17 03:55:29.000000000 -0800@@ -54,11 +54,11 @@ } initialised = 1; - upcase_table = map_file(lib_path("upcase.dat"), 0x20000);+ upcase_table = map_file(data_path("upcase.dat"), 0x20000); upcase_table_use_unmap = ( upcase_table != NULL ); - lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);+ lowcase_table = map_file(data_path("lowcase.dat"), 0x20000); lowcase_table_use_unmap = ( lowcase_table != NULL ); #ifdef HAVE_SETLOCALE /* Get the name of the current locale. */@@ -161,7 +161,7 @@ return; } - valid_file = map_file(lib_path("valid.dat"), 0x10000);+ valid_file = map_file(data_path("valid.dat"), 0x10000); if (valid_file) { valid_table = valid_file; mapped_file = 1;diff -uNr samba-3.0.10.orig/source/libsmb/samlogon_cache.c samba-3.0.10/source/libsmb/samlogon_cache.c--- samba-3.0.10.orig/source/libsmb/samlogon_cache.c 2004-12-17 03:50:08.000000000 -0800+++ samba-3.0.10/source/libsmb/samlogon_cache.c 2004-12-17 03:55:29.000000000 -0800@@ -34,7 +34,7 @@ BOOL netsamlogon_cache_init(void) { if (!netsamlogon_tdb) {- netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,+ netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0600); } @@ -67,7 +67,7 @@ winbindd_cache.tdb open. Open the tdb if a NULL is passed. */ if (!tdb) {- tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000,+ tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000, TDB_DEFAULT, O_RDWR, 0600);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -