summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2014-04-14 22:35:21 +0200
committerChristian Ambach <ambi@samba.org>2014-06-04 20:09:38 +0200
commit558850c495880a916fbc4285993e3adda590453f (patch)
tree79c04f9beafb82606ccad092a9500db10b7e746c
parent89961ca2972b087ae4a974ce223b75263ec1ee1f (diff)
downloadsamba-558850c495880a916fbc4285993e3adda590453f.tar.gz
samba-558850c495880a916fbc4285993e3adda590453f.tar.xz
samba-558850c495880a916fbc4285993e3adda590453f.zip
s3:lib/afs move afs_settoken.c to common lib dir
Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--lib/afs/afs_funcs.c1
-rw-r--r--lib/afs/afs_settoken.c (renamed from source3/lib/afs_settoken.c)24
-rw-r--r--lib/afs/afs_settoken.h21
-rw-r--r--lib/afs/wscript_build4
-rw-r--r--nsswitch/wbinfo.c1
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/modules/vfs_afsacl.c1
-rw-r--r--source3/utils/net_afs.c1
-rwxr-xr-xsource3/wscript_build4
9 files changed, 42 insertions, 20 deletions
diff --git a/lib/afs/afs_funcs.c b/lib/afs/afs_funcs.c
index 316bb1b5ec1..8a3c90a47e5 100644
--- a/lib/afs/afs_funcs.c
+++ b/lib/afs/afs_funcs.c
@@ -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>
diff --git a/source3/lib/afs_settoken.c b/lib/afs/afs_settoken.c
index 7aff55fd762..d0ffa49567f 100644
--- a/source3/lib/afs_settoken.c
+++ b/lib/afs/afs_settoken.c
@@ -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
index 00000000000..d6cc4621a76
--- /dev/null
+++ b/lib/afs/afs_settoken.h
@@ -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);
diff --git a/lib/afs/wscript_build b/lib/afs/wscript_build
index 45d8be5795f..7337491fe7c 100644
--- a/lib/afs/wscript_build
+++ b/lib/afs/wscript_build
@@ -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')
+
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index bc25a1722f7..a3e64514552 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -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
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 14af2ad6030..285ec7be321 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 730098760c9..7a3d5bd255f 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -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
diff --git a/source3/utils/net_afs.c b/source3/utils/net_afs.c
index 44e5193c884..6049a5cae14 100644
--- a/source3/utils/net_afs.c
+++ b/source3/utils/net_afs.c
@@ -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)
{
diff --git a/source3/wscript_build b/source3/wscript_build
index 1f1b75049aa..5995003dc4a 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -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''',