From 592c0b1018fadc8fd3ed084bb4f3deba31ed4b4d Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 30 Jun 2011 16:59:48 +0200 Subject: [PATCH] s3:afs fix the build for --with-fakekaserver (Bug 8263) fix compile errors and warnings --- source3/include/proto.h | 2 +- source3/lib/afs.c | 20 +++++++++++++------- source3/lib/afs_settoken.c | 8 +++++--- source3/modules/vfs_afsacl.c | 11 +++++++---- source3/utils/net_afs.c | 8 +++++--- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 73bd9ba..30fb313 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -46,7 +46,7 @@ char *afs_createtoken_str(const char *username, const char *cell); /* The following definitions come from lib/afs_settoken.c */ int afs_syscall( int subcall, - char * path, + const char * path, int cmd, char * cmarg, int follow); diff --git a/source3/lib/afs.c b/source3/lib/afs.c index 61a588c..4d9cfde 100644 --- a/source3/lib/afs.c +++ b/source3/lib/afs.c @@ -23,6 +23,10 @@ #define NO_ASN1_TYPEDEFS 1 +#include "secrets.h" +#include "passdb.h" +#include "auth.h" +#include "../librpc/gen_ndr/ndr_netlogon.h" #include #include #include @@ -121,7 +125,7 @@ static bool afs_createtoken(const char *username, const char *cell, p += 4; /* We need to create a session key */ - generate_random_buffer(p, 8); + generate_random_buffer((uint8_t *)p, 8); /* Our client code needs the the key in the clear, it does not know the server-key ... */ @@ -171,7 +175,8 @@ static bool afs_createtoken(const char *username, const char *cell, len = PTR_DIFF(p, clear_ticket); des_key_sched((const_des_cblock *)key.key, key_schedule); - des_pcbc_encrypt(clear_ticket, clear_ticket, + des_pcbc_encrypt((const unsigned char*)clear_ticket, + (unsigned char*) clear_ticket, len, key_schedule, (C_Block *)key.key, 1); ZERO_STRUCT(key); @@ -231,17 +236,18 @@ bool afs_login(connection_struct *conn) } afs_username = talloc_sub_advanced(ctx, - SNUM(conn), conn->session_info->unix_name, + lp_servicename(SNUM(conn)), + conn->session_info->unix_name, conn->connectpath, conn->session_info->utok.gid, conn->session_info->sanitized_username, - pdb_get_domain(conn->session_info->sam_account), + conn->session_info->info3->base.domain.string, afs_username); if (!afs_username) { return false; } - user_sid = &conn->session_info->security_token->user_sids[0]; - afs_username = talloc_string_sub(talloc_tos(), + user_sid = &conn->session_info->security_token->sids[0]; + afs_username = talloc_string_sub(ctx, afs_username, "%s", sid_string_tos(user_sid)); @@ -268,7 +274,7 @@ bool afs_login(connection_struct *conn) afs_username, cell)); if (!afs_createtoken(afs_username, cell, &ticket, &ct)) - return False; + return false; /* For which Unix-UID do we want to set the token? */ ct.ViceId = getuid(); diff --git a/source3/lib/afs_settoken.c b/source3/lib/afs_settoken.c index 80eed13..6c9efe2 100644 --- a/source3/lib/afs_settoken.c +++ b/source3/lib/afs_settoken.c @@ -23,6 +23,7 @@ #define NO_ASN1_TYPEDEFS 1 +#include "system/filesys.h" #include #include #include @@ -42,13 +43,14 @@ int afs_syscall( int subcall, return( syscall( SYS_afs_syscall, subcall, path, cmd, cmarg, follow)); */ int errcode; + int proc_afs_file; struct afsprocdata afs_syscall_data; afs_syscall_data.syscall = subcall; afs_syscall_data.param1 = (long)path; afs_syscall_data.param2 = cmd; afs_syscall_data.param3 = (long)cmarg; afs_syscall_data.param4 = follow; - int proc_afs_file = open(PROC_SYSCALL_FNAME, O_RDWR); + proc_afs_file = open(PROC_SYSCALL_FNAME, O_RDWR); if (proc_afs_file < 0) proc_afs_file = open(PROC_SYSCALL_ARLA_FNAME, O_RDWR); if (proc_afs_file < 0) @@ -103,8 +105,8 @@ static bool afs_decode_token(const char *string, char **cell, if ( (blob.data == NULL) || (blob.length != sizeof(result_ct.HandShakeKey) )) { - DEBUG(10, ("invalid key: %x/%d\n", (uint32)blob.data, - blob.length)); + DEBUG(10, ("invalid key: %x/%lu\n", (uint8_t)*blob.data, + (unsigned long)blob.length)); return False; } diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index 2ef6adf..ec9194a 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -20,6 +20,10 @@ #include "includes.h" #include "system/filesys.h" #include "smbd/smbd.h" +#include "../librpc/gen_ndr/lsa.h" +#include "../libcli/security/security.h" +#include "../libcli/security/dom_sid.h" +#include "passdb.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_VFS @@ -43,7 +47,7 @@ static char space_replacement = '%'; /* Do we expect SIDs as pts names? */ static bool sidpts; -extern int afs_syscall(int, char *, int, char *, int); +extern int afs_syscall(int, const char *, int, char *, int); struct afs_ace { bool positive; @@ -299,11 +303,10 @@ static bool unparse_afs_acl(struct afs_acl *acl, char *acl_str) int positives = 0; int negatives = 0; fstring line; + struct afs_ace *ace = acl->acelist; *acl_str = 0; - struct afs_ace *ace = acl->acelist; - while (ace != NULL) { if (ace->positive) positives++; @@ -825,7 +828,7 @@ static bool nt_to_afs_acl(const char *filename, return True; } -static bool afs_get_afs_acl(char *filename, struct afs_acl *acl) +static bool afs_get_afs_acl(const char *filename, struct afs_acl *acl) { struct afs_iob iob; diff --git a/source3/utils/net_afs.c b/source3/utils/net_afs.c index f6b2b2d..4b90778 100644 --- a/source3/utils/net_afs.c +++ b/source3/utils/net_afs.c @@ -19,6 +19,8 @@ #include "includes.h" #include "utils/net.h" +#include "secrets.h" +#include "system/filesys.h" int net_afs_usage(struct net_context *c, int argc, const char **argv) { @@ -35,7 +37,7 @@ int net_afs_key(struct net_context *c, int argc, const char **argv) struct afs_keyfile keyfile; if (argc != 2) { - d_printf(_("Usage:")," net afs key cell\n"); + d_fprintf(stderr, _("Usage: net afs key cell\n")); return -1; } @@ -70,8 +72,8 @@ int net_afs_impersonate(struct net_context *c, int argc, char *token; if (argc != 2) { - fprintf(stderr, _("Usage:")," net afs impersonate \n"); - exit(1); + d_fprintf(stderr, _("Usage: net afs impersonate \n")); + exit(1); } token = afs_createtoken_str(argv[0], argv[1]); -- 1.7.1