Blame SOURCES/krb5-master-move-otp-sockets.patch

4be148
Adjusted to apply to 1.12.2.
7d335d
7d335d
commit 1e4bdcfed2c7bda94d5c135cc32a5993ca032501
7d335d
Author: Nathaniel McCallum <npmccallum@redhat.com>
7d335d
Date:   Wed Feb 5 10:59:46 2014 -0500
7d335d
7d335d
    Move OTP sockets to KDC_RUN_DIR
7d335d
    
7d335d
    Some system configurations expect Unix-domain sockets to live under
7d335d
    /run or /var/run, and not other parts of /var where persistent
7d335d
    application state lives.  Define a new directory KDC_RUN_DIR using
7d335d
    $runstatedir (new in autoconf 2.70, so fall back to $localstatedir/run
7d335d
    if it's not set) and use that for the default socket path.
7d335d
    
7d335d
    [ghudson@mit.edu: commit message, otp.rst formatting fix]
7d335d
    
7d335d
    ticket: 7859 (new)
7d335d
4be148
diff --git a/doc/admin/otp.rst b/doc/admin/otp.rst
4be148
index 0abd5ff..f12c36d 100644
4be148
--- a/doc/admin/otp.rst
4be148
+++ b/doc/admin/otp.rst
4be148
@@ -23,7 +23,7 @@ the following format::
4be148
 
4be148
     [otp]
4be148
         <name> = {
4be148
-            server = <host:port or filename> (default: $KDCDIR/<name>.socket)
4be148
+            server = <host:port or filename> (default: see below)
4be148
             secret = <filename>
4be148
             timeout = <integer> (default: 5 [seconds])
4be148
             retries = <integer> (default: 3)
4be148
@@ -33,7 +33,8 @@ the following format::
4be148
 If the server field begins with '/', it will be interpreted as a UNIX
4be148
 socket.  Otherwise, it is assumed to be in the format host:port.  When
4be148
 a UNIX domain socket is specified, the secret field is optional and an
4be148
-empty secret is used by default.
4be148
+empty secret is used by default.  If the server field is not
4be148
+specified, it defaults to |kdcrundir|\ ``/<name>.socket``.
4be148
 
4be148
 When forwarding the request over RADIUS, by default the principal is
4be148
 used in the User-Name attribute of the RADIUS packet.  The strip_realm
7d335d
diff --git a/doc/conf.py b/doc/conf.py
7d335d
index f015fc8..bc8b2bd 100644
7d335d
--- a/doc/conf.py
7d335d
+++ b/doc/conf.py
7d335d
@@ -231,6 +231,7 @@ if 'mansubs' in tags:
7d335d
     sbindir = '``@SBINDIR@``'
7d335d
     libdir = '``@LIBDIR@``'
7d335d
     localstatedir = '``@LOCALSTATEDIR@``'
7d335d
+    runstatedir = '``@RUNSTATEDIR@``'
7d335d
     sysconfdir = '``@SYSCONFDIR@``'
7d335d
     ccache = '``@CCNAME@``'
7d335d
     keytab = '``@KTNAME@``'
7d335d
@@ -243,6 +244,7 @@ else:
7d335d
     sbindir = ':ref:`SBINDIR <paths>`'
7d335d
     libdir = ':ref:`LIBDIR <paths>`'
7d335d
     localstatedir = ':ref:`LOCALSTATEDIR <paths>`'
7d335d
+    runstatedir = ':ref:`RUNSTATEDIR <paths>`'
7d335d
     sysconfdir = ':ref:`SYSCONFDIR <paths>`'
7d335d
     ccache = ':ref:`DEFCCNAME <paths>`'
7d335d
     keytab = ':ref:`DEFKTNAME <paths>`'
7d335d
@@ -262,6 +264,7 @@ else:
7d335d
     rst_epilog += '.. |sbindir| replace:: %s\n' % sbindir
7d335d
     rst_epilog += '.. |libdir| replace:: %s\n' % libdir
7d335d
     rst_epilog += '.. |kdcdir| replace:: %s\\ ``/krb5kdc``\n' % localstatedir
7d335d
+    rst_epilog += '.. |kdcrundir| replace:: %s\\ ``/krb5kdc``\n' % runstatedir
7d335d
     rst_epilog += '.. |sysconfdir| replace:: %s\n' % sysconfdir
7d335d
     rst_epilog += '.. |ccache| replace:: %s\n' % ccache
7d335d
     rst_epilog += '.. |keytab| replace:: %s\n' % keytab
7d335d
diff --git a/doc/mitK5defaults.rst b/doc/mitK5defaults.rst
7d335d
index 89b8f4c..838dabb 100644
7d335d
--- a/doc/mitK5defaults.rst
7d335d
+++ b/doc/mitK5defaults.rst
7d335d
@@ -17,6 +17,7 @@ KDC config file :ref:`kdc.conf(5)`          |kdcdir|\ ``/kdc.conf``        **KRB
7d335d
 KDC database path (DB2)                     |kdcdir|\ ``/principal``
7d335d
 Master key :ref:`stash_definition`          |kdcdir|\ ``/.k5.``\ *realm*
7d335d
 Admin server ACL file :ref:`kadm5.acl(5)`   |kdcdir|\ ``/kadm5.acl``
7d335d
+OTP socket directory                        |kdcrundir|
7d335d
 Plugin base directory                       |libdir|\ ``/krb5/plugins``
7d335d
 :ref:`rcache_definition` directory          ``/var/tmp``                   **KRB5RCACHEDIR**
7d335d
 Master key default enctype                  |defmkey|
7d335d
@@ -64,6 +65,7 @@ Description                 Symbolic name  Custom build path            Typical
7d335d
 User programs               BINDIR         ``/usr/local/bin``           ``/usr/bin``
7d335d
 Libraries and plugins       LIBDIR         ``/usr/local/lib``           ``/usr/lib``
7d335d
 Parent of KDC state dir     LOCALSTATEDIR  ``/usr/local/var``           ``/var``
7d335d
+Parent of KDC runtime dir   RUNSTATEDIR    ``/usr/local/var/run``       ``/run``
7d335d
 Administrative programs     SBINDIR        ``/usr/local/sbin``          ``/usr/sbin``
7d335d
 Alternate krb5.conf dir     SYSCONFDIR     ``/usr/local/etc``           ``/etc``
7d335d
 Default ccache name         DEFCCNAME      ``FILE:/tmp/krb5cc_%{uid}``  ``FILE:/tmp/krb5cc_%{uid}``
7d335d
diff --git a/src/Makefile.in b/src/Makefile.in
7d335d
index a8bc990..1725093 100644
7d335d
--- a/src/Makefile.in
7d335d
+++ b/src/Makefile.in
7d335d
@@ -64,6 +64,7 @@ INSTALLMKDIRS = $(KRB5ROOT) $(KRB5MANROOT) $(KRB5OTHERMKDIRS) \
7d335d
 		$(KRB5_AD_MODULE_DIR) \
4be148
 		$(KRB5_LIBKRB5_MODULE_DIR) $(KRB5_TLS_MODULE_DIR) \
7d335d
 		@localstatedir@ @localstatedir@/krb5kdc \
7d335d
+		@runstatedir@ @runstatedir@/krb5kdc \
4be148
 		$(KRB5_INCSUBDIRS) $(datadir) $(EXAMPLEDIR) \
4be148
 		$(PKGCONFIG_DIR)
7d335d
 
7d335d
diff --git a/src/configure.in b/src/configure.in
7d335d
index 2145d54..c2eaf78 100644
7d335d
--- a/src/configure.in
7d335d
+++ b/src/configure.in
4be148
@@ -9,6 +9,12 @@
4be148
 fi
4be148
 AC_SUBST(SYSCONFCONF)
7d335d
 
7d335d
+# If $runstatedir isn't set by autoconf (<2.70), set it manually.
7d335d
+if test x"$runstatedir" == x; then
7d335d
+  runstatedir=$localstatedir/run
7d335d
+fi
7d335d
+AC_SUBST(runstatedir)
7d335d
+
7d335d
 CONFIG_RULES
7d335d
 KRB5_VERSION=K5_VERSION
7d335d
 AC_SUBST(KRB5_VERSION)
7d335d
diff --git a/src/doc/Makefile.in b/src/doc/Makefile.in
7d335d
index a6bb7c5..b07e16a 100644
7d335d
--- a/src/doc/Makefile.in
7d335d
+++ b/src/doc/Makefile.in
7d335d
@@ -7,6 +7,7 @@ DOXYGEN=doxygen
7d335d
 
7d335d
 docsrc=$(top_srcdir)/../doc
7d335d
 localstatedir=@localstatedir@
7d335d
+runstatedir=@runstatedir@
7d335d
 sysconfdir=@sysconfdir@
7d335d
 DEFCCNAME=@DEFCCNAME@
7d335d
 DEFKTNAME=@DEFKTNAME@
7d335d
@@ -113,6 +114,7 @@ paths.py:
7d335d
 	echo 'sbindir = "``$(SERVER_BINDIR)``"' >> $@
7d335d
 	echo 'libdir = "``$(KRB5_LIBDIR)``"' >> $@
7d335d
 	echo 'localstatedir = "``$(localstatedir)``"' >> $@
7d335d
+	echo 'runstatedir = "``$(runstatedir)``"' >> $@
7d335d
 	echo 'sysconfdir = "``$(sysconfdir)``"' >> $@
7d335d
 	echo 'ccache = "``$(DEFCCNAME)``"' >> $@
7d335d
 	echo 'keytab = "``$(DEFKTNAME)``"' >> $@
7d335d
diff --git a/src/include/Makefile.in b/src/include/Makefile.in
7d335d
index e13042a..f83ff4e 100644
7d335d
--- a/src/include/Makefile.in
7d335d
+++ b/src/include/Makefile.in
7d335d
@@ -53,6 +53,7 @@ autoconf.stamp: $(srcdir)/autoconf.h.in $(BUILDTOP)/config.status
7d335d
 
7d335d
 SYSCONFDIR = @sysconfdir@
7d335d
 LOCALSTATEDIR = @localstatedir@
7d335d
+RUNSTATEDIR = @runstatedir@
7d335d
 BINDIR = @bindir@
7d335d
 SBINDIR = @sbindir@
7d335d
 LIBDIR  = @libdir@
7d335d
@@ -66,6 +67,7 @@ PROCESS_REPLACE = -e "s+@KRB5RCTMPDIR+$(KRB5RCTMPDIR)+" \
7d335d
 		  -e "s+@MODULEDIR+$(MODULE_DIR)+" \
7d335d
 		  -e "s+@GSSMODULEDIR+$(GSS_MODULE_DIR)+" \
7d335d
 		  -e 's+@LOCALSTATEDIR+$(LOCALSTATEDIR)+' \
7d335d
+		  -e 's+@RUNSTATEDIR+$(RUNSTATEDIR)+' \
7d335d
 		  -e 's+@SYSCONFDIR+$(SYSCONFDIR)+' \
4be148
 		  -e 's+@DYNOBJEXT+$(DYNOBJEXT)+' \
4be148
 		  -e 's+@SYSCONFCONF+$(SYSCONFCONF)+'
7d335d
diff --git a/src/include/osconf.hin b/src/include/osconf.hin
7d335d
index 90ab86d..871503a 100644
7d335d
--- a/src/include/osconf.hin
7d335d
+++ b/src/include/osconf.hin
7d335d
@@ -59,6 +59,7 @@
7d335d
 #define PLUGIN_EXT              "@DYNOBJEXT"
7d335d
 
7d335d
 #define KDC_DIR                 "@LOCALSTATEDIR/krb5kdc"
7d335d
+#define KDC_RUN_DIR             "@RUNSTATEDIR/krb5kdc"
7d335d
 #define DEFAULT_KDB_FILE        KDC_DIR "/principal"
7d335d
 #define DEFAULT_KEYFILE_STUB    KDC_DIR "/.k5."
7d335d
 #define KRB5_DEFAULT_ADMIN_ACL  KDC_DIR "/krb5_adm.acl"
7d335d
diff --git a/src/man/Makefile.in b/src/man/Makefile.in
7d335d
index 4dd2448..2b9c892 100644
7d335d
--- a/src/man/Makefile.in
7d335d
+++ b/src/man/Makefile.in
7d335d
@@ -5,6 +5,7 @@ SPHINX_BUILD=sphinx-build
7d335d
 GROFF=@GROFF@
7d335d
 GROFF_MAN=$(GROFF) -mtty-char -Tascii -mandoc -c
7d335d
 localstatedir=@localstatedir@
7d335d
+runstatedir=@runstatedir@
7d335d
 sysconfdir=@sysconfdir@
7d335d
 DEFCCNAME=@DEFCCNAME@
7d335d
 DEFKTNAME=@DEFKTNAME@
7d335d
@@ -44,6 +45,7 @@ $(docsrc)/version.py: $(top_srcdir)/patchlevel.h
7d335d
 	    -e 's|@SBINDIR@|$(SERVER_BINDIR)|g' \
7d335d
 	    -e 's|@LIBDIR@|$(KRB5_LIBDIR)|g' \
7d335d
 	    -e 's|@LOCALSTATEDIR@|$(localstatedir)|g' \
7d335d
+	    -e 's|@RUNSTATEDIR@|$(runstatedir)|g' \
7d335d
 	    -e 's|@SYSCONFDIR@|$(sysconfdir)|g' \
7d335d
 	    -e 's|@CCNAME@|$(DEFCCNAME)|g' \
7d335d
 	    -e 's|@KTNAME@|$(DEFKTNAME)|g' \
7d335d
diff --git a/src/plugins/preauth/otp/otp_state.c b/src/plugins/preauth/otp/otp_state.c
7d335d
index a4d7e3b..4643dff 100644
7d335d
--- a/src/plugins/preauth/otp/otp_state.c
7d335d
+++ b/src/plugins/preauth/otp/otp_state.c
7d335d
@@ -40,7 +40,7 @@
7d335d
 #endif
7d335d
 
7d335d
 #define DEFAULT_TYPE_NAME "DEFAULT"
7d335d
-#define DEFAULT_SOCKET_FMT KDC_DIR "/%s.socket"
7d335d
+#define DEFAULT_SOCKET_FMT KDC_RUN_DIR "/%s.socket"
7d335d
 #define DEFAULT_TIMEOUT 5
7d335d
 #define DEFAULT_RETRIES 3
7d335d
 #define MAX_SECRET_LEN 1024