s3:lib/afs move afs_settoken.c to common lib dir
authorChristian Ambach <ambi@samba.org>
Mon, 14 Apr 2014 20:35:21 +0000 (22:35 +0200)
committerChristian Ambach <ambi@samba.org>
Wed, 4 Jun 2014 18:09:38 +0000 (20:09 +0200)
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/afs/afs_funcs.c
lib/afs/afs_settoken.c [moved from source3/lib/afs_settoken.c with 97% similarity]
lib/afs/afs_settoken.h [new file with mode: 0644]
lib/afs/wscript_build
nsswitch/wbinfo.c
source3/include/proto.h
source3/modules/vfs_afsacl.c
source3/utils/net_afs.c
source3/wscript_build

index 316bb1b5ec1030512e8a0b86df533eb452d47779..8a3c90a47e59cbe068bc6e4ff1f3b0f98e8af065 100644 (file)
@@ -28,6 +28,7 @@
 #include "passdb.h"
 #include "auth.h"
 #include "../librpc/gen_ndr/ndr_netlogon.h"
+#include "lib/afs/afs_settoken.h"
 
 #include <afs/param.h>
 #include <afs/stds.h>
similarity index 97%
rename from source3/lib/afs_settoken.c
rename to lib/afs/afs_settoken.c
index 7aff55fd762278bf74a82f4ecf6dda5fabfe66d2..d0ffa49567fb419799c808006a858e29c014a0fd 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  *  Unix SMB/CIFS implementation.
  *  Generate AFS tickets
  *  Copyright (C) Volker Lendecke 2004
@@ -7,17 +7,18 @@
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 3 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "includes.h"
+#include "lib/afs/afs_settoken.h"
 
 #ifdef WITH_FAKE_KASERVER
 
@@ -27,7 +28,7 @@
 
 #include <afs/param.h>
 #include <afs/stds.h>
-#include <afs/afs.h>
+#include <afs/afs_args.h>
 #include <afs/auth.h>
 #include <afs/venus.h>
 #include <asm/unistd.h>
@@ -92,7 +93,7 @@ static bool afs_decode_token(const char *string, char **cell,
                DEBUG(10, ("sscanf AuthHandle failed\n"));
                return false;
        }
-               
+
        if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
                DEBUG(10, ("strtok_r failed\n"));
                return false;
@@ -120,7 +121,7 @@ static bool afs_decode_token(const char *string, char **cell,
                DEBUG(10, ("sscanf ViceId failed\n"));
                return false;
        }
-               
+
        if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
                DEBUG(10, ("strtok_r failed\n"));
                return false;
@@ -130,7 +131,7 @@ static bool afs_decode_token(const char *string, char **cell,
                DEBUG(10, ("sscanf BeginTimestamp failed\n"));
                return false;
        }
-               
+
        if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
                DEBUG(10, ("strtok_r failed\n"));
                return false;
@@ -140,7 +141,7 @@ static bool afs_decode_token(const char *string, char **cell,
                DEBUG(10, ("sscanf EndTimestamp failed\n"));
                return false;
        }
-               
+
        if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
                DEBUG(10, ("strtok_r failed\n"));
                return false;
@@ -166,7 +167,7 @@ static bool afs_decode_token(const char *string, char **cell,
   This is currently highly Linux and OpenAFS-specific. The correct API
   call for this would be ktc_SetToken. But to do that we would have to
   import a REALLY big bunch of libraries which I would currently like
-  to avoid. 
+  to avoid.
 */
 
 static bool afs_settoken(const char *cell,
@@ -235,8 +236,9 @@ bool afs_settoken_str(const char *token_string)
        if (!afs_decode_token(token_string, &cell, &ticket, &ct))
                return false;
 
-       if (geteuid() != sec_initial_uid())
-               ct.ViceId = getuid();
+       if (geteuid() != 0) {
+               ct.ViceId = geteuid();
+       }
 
        result = afs_settoken(cell, &ct, ticket);
 
diff --git a/lib/afs/afs_settoken.h b/lib/afs/afs_settoken.h
new file mode 100644 (file)
index 0000000..d6cc462
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Generate AFS tickets
+ *  Copyright (C) Volker Lendecke 2004
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+int afs_syscall(int subcall, const char *path, int cmd, char *cmarg, int follow);
+bool afs_settoken_str(const char *token_string);
index 45d8be5795f6794578d767bbb6507914bd98d738..7337491fe7c9d01d2c0be75d93cfda15735974f5 100644 (file)
@@ -4,3 +4,7 @@ bld.SAMBA3_SUBSYSTEM('LIBAFS',
                     source='afs_funcs.c',
                     deps='samba-util LIBAFS_SETTOKEN')
 
+bld.SAMBA3_SUBSYSTEM('LIBAFS_SETTOKEN',
+                    source='afs_settoken.c',
+                    deps='samba-util')
+
index bc25a1722f7ed592024e787fc396715d3a426e39..a3e645145525eba7cdfc284869c97fe194cc1017 100644 (file)
@@ -27,6 +27,7 @@
 #include "lib/popt/popt.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "lib/cmdline/popt_common.h"
+#include "lib/afs/afs_settoken.h"
 
 #ifdef DBGC_CLASS
 #undef DBGC_CLASS
index 14af2ad6030ec3a82b0f21f32119e05bb41a3c47..285ec7be32198dcd00fc3d3ad650a49ebe4c407f 100644 (file)
@@ -35,11 +35,6 @@ bool allow_access(const char **deny_list,
 
 /* The following definitions come from lib/adt_tree.c  */
 
-/* The following definitions come from lib/afs_settoken.c  */
-
-int afs_syscall(int subcall, const char *path, int cmd, char *cmarg, int follow);
-bool afs_settoken_str(const char *token_string);
-
 /* The following definitions come from lib/audit.c  */
 
 const char *audit_category_str(uint32 category);
index 730098760c917d90b7fccfdf4b08e6186dafe00f..7a3d5bd255fb3a65836c85584799312b4f03027a 100644 (file)
@@ -24,6 +24,7 @@
 #include "../libcli/security/security.h"
 #include "../libcli/security/dom_sid.h"
 #include "passdb.h"
+#include "lib/afs/afs_settoken.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
index 44e5193c88467f4d9bd73d011bcd9af279b640c8..6049a5cae1482ca4a38ec6740b43827db41c8357 100644 (file)
@@ -23,6 +23,7 @@
 #include "secrets.h"
 #include "system/filesys.h"
 #include "lib/afs/afs_funcs.h"
+#include "lib/afs/afs_settoken.h"
 
 int net_afs_usage(struct net_context *c, int argc, const char **argv)
 {
index 1f1b75049aadb1e0b0c8d850b8c5576cf30d1893..5995003dc4a55276439d5f40a76a96148b9a2991 100755 (executable)
@@ -468,10 +468,6 @@ bld.SAMBA3_SUBSYSTEM('LIBADS_PRINTER',
                     source='libads/ldap_printer.c',
                     deps='samba-util krb5samba')
 
-bld.SAMBA3_SUBSYSTEM('LIBAFS_SETTOKEN',
-                    source='lib/afs_settoken.c',
-                    deps='samba-util')
-
 bld.SAMBA3_LIBRARY('smbconf',
                    source='''lib/smbconf/smbconf_init.c
                    lib/smbconf/smbconf_reg.c''',