1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba

This commit is contained in:
Jeremy Allison 2009-02-24 17:33:47 -08:00
commit f68c091107
16 changed files with 211 additions and 544 deletions

View File

@ -689,7 +689,7 @@ AUTH_SAM_OBJ = auth/auth_sam.o
AUTH_SERVER_OBJ = auth/auth_server.o
AUTH_UNIX_OBJ = auth/auth_unix.o
AUTH_WINBIND_OBJ = auth/auth_winbind.o
AUTH_ONEFS_WB_OBJ = auth/auth_onefs_wb.o
AUTH_WBC_OBJ = auth/auth_wbc.o
AUTH_SCRIPT_OBJ = auth/auth_script.o
AUTH_NETLOGOND_OBJ = auth/auth_netlogond.o
@ -2355,9 +2355,9 @@ bin/winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_WINBIND_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(AUTH_WINBIND_OBJ)
bin/onefs_wb.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_ONEFS_WB_OBJ)
bin/wbc.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_WBC_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(AUTH_ONEFS_WB_OBJ)
@$(SHLD_MODULE) $(AUTH_WBC_OBJ)
bin/unix.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_UNIX_OBJ)
@echo "Building plugin $@"
@ -2375,9 +2375,9 @@ bin/tdbsam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_tdb.o
@echo "Building plugin $@"
@$(SHLD_MODULE) passdb/pdb_tdb.o
bin/onefs_sam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_onefs_sam.o
bin/wbc_sam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_wbc_sam.o
@echo "Building plugin $@"
@$(SHLD_MODULE) passdb/pdb_onefs_sam.o
@$(SHLD_MODULE) passdb/pdb_wbc_sam.o
bin/smbpasswd.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_smbpasswd.o
@echo "Building plugin $@"

View File

@ -1,7 +1,8 @@
/*
Unix SMB/CIFS implementation.
Winbind authentication mechnism, customized for onefs
Winbind client authentication mechanism designed to defer all
authentication to the winbind daemon.
Copyright (C) Tim Potter 2000
Copyright (C) Andrew Bartlett 2001 - 2002
@ -21,6 +22,21 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* This auth module is very similar to auth_winbind with 3 distinct
* differences.
*
* 1) Does not fallback to another auth module if winbindd is unavailable
* 2) Does not validate the domain of the user
* 3) Handles unencrypted passwords
*
* The purpose of this module is to defer all authentication decisions (ie:
* local user vs NIS vs LDAP vs AD; encrypted vs plaintext) to the wbc
* compatible daemon. This centeralizes all authentication decisions to a
* single provider.
*
* This auth backend is most useful when used in conjunction with pdb_wbc_sam.
*/
#include "includes.h"
#undef DBGC_CLASS
@ -28,7 +44,7 @@
/* Authenticate a user with a challenge/response */
static NTSTATUS check_onefs_wb_security(const struct auth_context *auth_context,
static NTSTATUS check_wbc_security(const struct auth_context *auth_context,
void *my_private_data,
TALLOC_CTX *mem_ctx,
const auth_usersupplied_info *user_info,
@ -116,19 +132,19 @@ static NTSTATUS check_onefs_wb_security(const struct auth_context *auth_context,
}
/* module initialisation */
static NTSTATUS auth_init_onefs_wb(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
static NTSTATUS auth_init_wbc(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
if (!make_auth_methods(auth_context, auth_method)) {
return NT_STATUS_NO_MEMORY;
}
(*auth_method)->name = "onefs_wb";
(*auth_method)->auth = check_onefs_wb_security;
(*auth_method)->name = "wbc";
(*auth_method)->auth = check_wbc_security;
return NT_STATUS_OK;
}
NTSTATUS auth_onefs_wb_init(void)
NTSTATUS auth_wbc_init(void)
{
return smb_register_auth(AUTH_INTERFACE_VERSION, "onefs_wb", auth_init_onefs_wb);
return smb_register_auth(AUTH_INTERFACE_VERSION, "wbc", auth_init_wbc);
}

View File

@ -414,7 +414,7 @@ AC_SUBST(DYNEXP)
dnl Add modules that have to be built by default here
dnl These have to be built static:
default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss2 rpc_eventlog auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
default_static_modules="pdb_smbpasswd pdb_tdbsam pdb_wbc_sam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss2 rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
dnl These are preferably build shared, and static if dlopen() is not available
default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb vfs_smb_traffic_analyzer"
@ -1088,7 +1088,7 @@ echo $samba_cv_HAVE_ONEFS
if test x"$samba_cv_HAVE_ONEFS" = x"yes"; then
AC_DEFINE(HAVE_ONEFS,1,[Whether building on Isilon OneFS])
default_shared_modules="$default_shared_modules vfs_onefs vfs_onefs_shadow_copy perfcount_onefs"
default_static_modules="$default_static_modules auth_onefs_wb pdb_onefs_sam"
default_static_modules="$default_static_modules"
ONEFS_LIBS="-lisi_acl -lisi_ecs -lisi_event -lisi_util"
# Need to also add general libs for oplocks support
save_LIBS="$save_LIBS -lisi_ecs -lisi_event -lisi_util -ldevstat"
@ -6130,7 +6130,7 @@ SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT"
[ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
SMB_MODULE(pdb_onefs_sam, passdb/pdb_onefs_sam.o, "bin/onefs_sam.$SHLIBEXT", PDB)
SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
@ -6173,7 +6173,7 @@ SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
SMB_MODULE(auth_sam, \$(AUTH_SAM_OBJ), "bin/sam.$SHLIBEXT", AUTH)
SMB_MODULE(auth_unix, \$(AUTH_UNIX_OBJ), "bin/unix.$SHLIBEXT", AUTH)
SMB_MODULE(auth_winbind, \$(AUTH_WINBIND_OBJ), "bin/winbind.$SHLIBEXT", AUTH)
SMB_MODULE(auth_onefs_wb, \$(AUTH_ONEFS_WB_OBJ), "bin/onefs_wb.$SHLIBEXT", AUTH)
SMB_MODULE(auth_wbc, \$(AUTH_WBC_OBJ), "bin/wbc.$SHLIBEXT", AUTH)
SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)

View File

@ -5867,11 +5867,6 @@ uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info);
uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info);
uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info);
bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u,
const POLICY_HND *hnd,
const fstring architecture,
uint32 level, uint32 clientmajor, uint32 clientminor,
RPC_BUFFER *buffer, uint32 offered);
bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth);
bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth);
bool make_spoolss_q_enumprinters(
@ -5929,18 +5924,7 @@ bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il,
bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth);
bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u,
prs_struct *ps, int depth);
bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u,
prs_struct *ps, int depth);
bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u,
prs_struct *ps, int depth);
bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth);
bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth);
bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name,
uint32 level, PRINTER_DRIVER_CTR *info);
bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth);
bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth);
bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
NT_PRINTER_INFO_LEVEL_2 *d);
bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth);

View File

@ -945,82 +945,6 @@ typedef struct spool_printer_info_level
}
SPOOL_PRINTER_INFO_LEVEL;
typedef struct spool_printer_driver_info_level_3
{
uint32 cversion;
uint32 name_ptr;
uint32 environment_ptr;
uint32 driverpath_ptr;
uint32 datafile_ptr;
uint32 configfile_ptr;
uint32 helpfile_ptr;
uint32 monitorname_ptr;
uint32 defaultdatatype_ptr;
uint32 dependentfilessize;
uint32 dependentfiles_ptr;
UNISTR2 name;
UNISTR2 environment;
UNISTR2 driverpath;
UNISTR2 datafile;
UNISTR2 configfile;
UNISTR2 helpfile;
UNISTR2 monitorname;
UNISTR2 defaultdatatype;
BUFFER5 dependentfiles;
}
SPOOL_PRINTER_DRIVER_INFO_LEVEL_3;
/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
typedef struct {
uint32 version;
uint32 name_ptr;
uint32 environment_ptr;
uint32 driverpath_ptr;
uint32 datafile_ptr;
uint32 configfile_ptr;
uint32 helpfile_ptr;
uint32 monitorname_ptr;
uint32 defaultdatatype_ptr;
uint32 dependentfiles_len;
uint32 dependentfiles_ptr;
uint32 previousnames_len;
uint32 previousnames_ptr;
NTTIME driverdate;
uint64 driverversion;
uint32 dummy4;
uint32 mfgname_ptr;
uint32 oemurl_ptr;
uint32 hardwareid_ptr;
uint32 provider_ptr;
UNISTR2 name;
UNISTR2 environment;
UNISTR2 driverpath;
UNISTR2 datafile;
UNISTR2 configfile;
UNISTR2 helpfile;
UNISTR2 monitorname;
UNISTR2 defaultdatatype;
BUFFER5 dependentfiles;
BUFFER5 previousnames;
UNISTR2 mfgname;
UNISTR2 oemurl;
UNISTR2 hardwareid;
UNISTR2 provider;
} SPOOL_PRINTER_DRIVER_INFO_LEVEL_6;
typedef struct spool_printer_driver_info_level
{
uint32 level;
uint32 ptr;
SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
}
SPOOL_PRINTER_DRIVER_INFO_LEVEL;
typedef struct spool_q_setprinter
{
POLICY_HND handle;
@ -1057,23 +981,6 @@ typedef struct {
WERROR status;
} SPOOL_R_ADDPRINTEREX;
/********************************************/
typedef struct spool_q_addprinterdriver
{
uint32 server_name_ptr;
UNISTR2 server_name;
uint32 level;
SPOOL_PRINTER_DRIVER_INFO_LEVEL info;
}
SPOOL_Q_ADDPRINTERDRIVER;
typedef struct spool_r_addprinterdriver
{
WERROR status;
}
SPOOL_R_ADDPRINTERDRIVER;
typedef struct spool_q_enumprintprocessors
{
uint32 name_ptr;

View File

@ -75,6 +75,10 @@ enum profile_stats_values
#define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count)
#define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time)
PR_VALUE_SYSCALL_CREATEFILE,
#define syscall_createfile_count __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, count)
#define syscall_createfile_time __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, time)
PR_VALUE_SYSCALL_CLOSE,
#define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count)
#define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time)
@ -111,6 +115,10 @@ enum profile_stats_values
#define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count)
#define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time)
PR_VALUE_SYSCALL_RENAME_AT,
#define syscall_rename_at_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, count)
#define syscall_rename_at_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, time)
PR_VALUE_SYSCALL_FSYNC,
#define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count)
#define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time)
@ -215,6 +223,26 @@ enum profile_stats_values
#define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count)
#define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time)
PR_VALUE_SYSCALL_GET_SD,
#define syscall_get_sd_count __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, count)
#define syscall_get_sd_time __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, time)
PR_VALUE_SYSCALL_SET_SD,
#define syscall_set_sd_count __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, count)
#define syscall_set_sd_time __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, time)
PR_VALUE_SYSCALL_BRL_LOCK,
#define syscall_brl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, count)
#define syscall_brl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, time)
PR_VALUE_SYSCALL_BRL_UNLOCK,
#define syscall_brl_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, count)
#define syscall_brl_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, time)
PR_VALUE_SYSCALL_BRL_CANCEL,
#define syscall_brl_cancel_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, count)
#define syscall_brl_cancel_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, time)
/* counters for individual SMB types */
PR_VALUE_SMBMKDIR,
#define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count)

View File

@ -273,9 +273,6 @@ onefs_samba_acl_to_acl(SEC_ACL *samba_acl, struct ifs_security_acl **acl,
if (aclu_initialize_acl(acl, aces, num_aces))
goto err_free;
if (aclu_initialize_acl(acl, aces, num_aces))
goto err_free;
/* Currently aclu_initialize_acl should copy the aces over, allowing
* us to immediately free */
free(aces);
@ -614,6 +611,8 @@ onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
bool fopened = false;
NTSTATUS status = NT_STATUS_OK;
START_PROFILE(syscall_get_sd);
*ppdesc = NULL;
DEBUG(5, ("Getting sd for file %s. security_info=%u\n",
@ -753,6 +752,9 @@ onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
DEBUG(5, ("Finished retrieving/canonicalizing SD!\n"));
/* FALLTHROUGH */
out:
END_PROFILE(syscall_get_sd);
if (alloced && sd) {
if (new_aces_alloced && sd->dacl->aces)
SAFE_FREE(sd->dacl->aces);
@ -892,14 +894,16 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
bool fopened = false;
NTSTATUS status;
START_PROFILE(syscall_set_sd);
DEBUG(5,("Setting SD on file %s.\n", fsp->fsp_name ));
status = onefs_samba_sd_to_sd(security_info_sent, psd, &sd,
SNUM(handle->conn));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("SD initialization failure: %s", nt_errstr(status)));
return status;
DEBUG(3, ("SD initialization failure: %s\n", nt_errstr(status)));
goto out;
}
fd = fsp->fh->fd;
@ -938,6 +942,8 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
/* FALLTHROUGH */
out:
END_PROFILE(syscall_set_sd);
if (fopened)
close(fd);

View File

@ -255,6 +255,8 @@ NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
struct onefs_cbrl_blr_state *bs;
NTSTATUS status;
START_PROFILE(syscall_brl_lock);
SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
SMB_ASSERT(plock->lock_type != UNLOCK_LOCK);
@ -301,10 +303,13 @@ NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
/* ASYNC still in progress: The process_* calls will keep
* calling even if we haven't gotten the lock. Keep erroring
* without calling ifs_cbrl, or getting/setting an id. */
if (bs->state == ONEFS_CBRL_ASYNC)
if (bs->state == ONEFS_CBRL_ASYNC) {
goto failure;
else if (bs->state == ONEFS_CBRL_ERROR)
}
else if (bs->state == ONEFS_CBRL_ERROR) {
END_PROFILE(syscall_brl_lock);
return NT_STATUS_NO_MEMORY;
}
SMB_ASSERT(bs->state == ONEFS_CBRL_NONE);
async = true;
@ -343,6 +348,9 @@ NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
}
failure:
END_PROFILE(syscall_brl_lock);
/* Failure - error or async. */
plock->context.smbpid = (uint32) ONEFS_BLOCKING_PID;
@ -355,6 +363,9 @@ failure:
return status;
success:
END_PROFILE(syscall_brl_lock);
/* Success. */
onefs_cbrl_enumerate_blq("onefs_brl_unlock_windows");
DEBUG(10, ("returning NT_STATUS_OK.\n"));
@ -371,6 +382,8 @@ bool onefs_brl_unlock_windows(vfs_handle_struct *handle,
int error;
int fd = br_lck->fsp->fh->fd;
START_PROFILE(syscall_brl_unlock);
SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
SMB_ASSERT(plock->lock_type == UNLOCK_LOCK);
@ -378,6 +391,9 @@ bool onefs_brl_unlock_windows(vfs_handle_struct *handle,
error = ifs_cbrl(fd, CBRL_OP_UNLOCK, CBRL_NOTYPE,
plock->start, plock->size, CBRL_NOTYPE, 0, plock->context.smbpid,
plock->context.tid, plock->fnum);
END_PROFILE(syscall_brl_unlock);
if (error) {
DEBUG(10, ("returning false.\n"));
return false;
@ -404,6 +420,8 @@ bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
int fd = br_lck->fsp->fh->fd;
struct onefs_cbrl_blr_state *bs;
START_PROFILE(syscall_brl_cancel);
SMB_ASSERT(plock);
SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
SMB_ASSERT(blr);
@ -416,6 +434,7 @@ bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
if (bs->state == ONEFS_CBRL_DONE) {
/* No-op. */
DEBUG(10, ("State=DONE, returning true\n"));
END_PROFILE(syscall_brl_cancel);
return true;
}
@ -427,6 +446,9 @@ bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
error = ifs_cbrl(fd, CBRL_OP_CANCEL, CBRL_NOTYPE, plock->start,
plock->size, CBRL_NOTYPE, bs->id, plock->context.smbpid,
plock->context.tid, plock->fnum);
END_PROFILE(syscall_brl_cancel);
if (error) {
DEBUG(10, ("returning false\n"));
bs->state = ONEFS_CBRL_ERROR;

View File

@ -160,18 +160,26 @@ int onefs_rename(vfs_handle_struct *handle, const char *oldname,
char *nbase = NULL;
char *nsname = NULL;
START_PROFILE(syscall_rename_at);
frame = talloc_stackframe();
ret = onefs_is_stream(oldname, &obase, &osname, &old_is_stream);
if (ret)
if (ret) {
END_PROFILE(syscall_rename_at);
return ret;
}
ret = onefs_is_stream(newname, &nbase, &nsname, &new_is_stream);
if (ret)
if (ret) {
END_PROFILE(syscall_rename_at);
return ret;
}
if (!old_is_stream && !new_is_stream) {
return SMB_VFS_NEXT_RENAME(handle, oldname, newname);
ret = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
END_PROFILE(syscall_rename_at);
return ret;
}
dir_fd = get_stream_dir_fd(handle->conn, obase, NULL);
@ -192,6 +200,8 @@ int onefs_rename(vfs_handle_struct *handle, const char *oldname,
}
done:
END_PROFILE(syscall_rename_at);
saved_errno = errno;
if (dir_fd >= 0) {
close(dir_fd);

View File

@ -95,6 +95,8 @@ int onefs_sys_create_file(connection_struct *conn,
uint32_t onefs_dos_attributes;
struct ifs_createfile_flags cf_flags = CF_FLAGS_NONE;
START_PROFILE(syscall_createfile);
/* Setup security descriptor and get secinfo. */
if (sd != NULL) {
NTSTATUS status;
@ -196,6 +198,7 @@ int onefs_sys_create_file(connection_struct *conn,
}
out:
END_PROFILE(syscall_createfile);
aclu_free_sd(pifs_sd, false);
return ret_fd;
@ -307,6 +310,8 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
bool atomic = false;
ssize_t ret = 0;
START_PROFILE_BYTES(syscall_sendfile, count);
if (lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
PARM_ATOMIC_SENDFILE,
PARM_ATOMIC_SENDFILE_DEFAULT)) {
@ -320,6 +325,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
/* If the sendfile wasn't atomic, we're done. */
if (!atomic) {
DEBUG(10, ("non-atomic sendfile read %ul bytes", ret));
END_PROFILE(syscall_sendfile);
return ret;
}
@ -391,6 +397,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
/* Handle case 1: short read -> truncated file. */
if (ret == 0) {
END_PROFILE(syscall_sendfile);
return ret;
}
@ -402,6 +409,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
PARM_SENDFILE_LARGE_READS_DEFAULT)) {
DEBUG(3, ("Not attempting non-atomic large sendfile: "
"%lu bytes\n", count));
END_PROFILE(syscall_sendfile);
return 0;
}
@ -421,6 +429,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
DEBUG(1, ("error on non-atomic large sendfile "
"(%lu bytes): %s\n", count,
strerror(errno)));
END_PROFILE(syscall_sendfile);
return ret;
}
@ -439,9 +448,11 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
if (lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
PARM_SENDFILE_SAFE,
PARM_SENDFILE_SAFE_DEFAULT)) {
END_PROFILE(syscall_sendfile);
return -1;
}
END_PROFILE(syscall_sendfile);
return ret;
}
@ -455,6 +466,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
count, strerror(errno)));
}
END_PROFILE(syscall_sendfile);
return ret;
}
@ -509,10 +521,13 @@ ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
off_t rbytes;
off_t wbytes;
START_PROFILE_BYTES(syscall_recvfile, count);
DEBUG(10,("onefs_recvfile: from = %d, to = %d, offset=%llu, count = "
"%lu\n", fromfd, tofd, offset, count));
if (count == 0) {
END_PROFILE(syscall_recvfile);
return 0;
}
@ -624,6 +639,9 @@ ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
ret = total_wbytes;
out:
END_PROFILE(syscall_recvfile);
/* Make sure we always try to drain the socket. */
if (!socket_drained && count - total_rbytes) {
int saved_errno = errno;

View File

@ -1,6 +1,8 @@
/*
Unix SMB/CIFS implementation.
Password and authentication handling for wbclient
Password and authentication handling by wbclient
Copyright (C) Andrew Bartlett 2002
Copyright (C) Jelmer Vernooij 2002
Copyright (C) Simo Sorce 2003
@ -21,12 +23,25 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* This passdb module retrieves full passdb information for local users and
* groups from a wbclient compatible daemon.
*
* The purpose of this module is to defer all SAM authorization information
* storage and retrieval to a wbc compatible daemon.
*
* This passdb backend is most useful when used in conjunction with auth_wbc.
*
* A few current limitations of this module are:
* - read only interface
* - no privileges
*/
#include "includes.h"
/***************************************************************************
Default implementations of some functions.
****************************************************************************/
static NTSTATUS _pdb_onefs_sam_getsampw(struct pdb_methods *methods,
static NTSTATUS _pdb_wbc_sam_getsampw(struct pdb_methods *methods,
struct samu *user,
const struct passwd *pwd)
{
@ -44,29 +59,29 @@ static NTSTATUS _pdb_onefs_sam_getsampw(struct pdb_methods *methods,
return result;
}
static NTSTATUS pdb_onefs_sam_getsampwnam(struct pdb_methods *methods, struct samu *user, const char *sname)
static NTSTATUS pdb_wbc_sam_getsampwnam(struct pdb_methods *methods, struct samu *user, const char *sname)
{
return _pdb_onefs_sam_getsampw(methods, user, winbind_getpwnam(sname));
return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwnam(sname));
}
static NTSTATUS pdb_onefs_sam_getsampwsid(struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
static NTSTATUS pdb_wbc_sam_getsampwsid(struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
{
return _pdb_onefs_sam_getsampw(methods, user, winbind_getpwsid(sid));
return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwsid(sid));
}
static bool pdb_onefs_sam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
static bool pdb_wbc_sam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
DOM_SID *sid)
{
return winbind_uid_to_sid(sid, uid);
}
static bool pdb_onefs_sam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
static bool pdb_wbc_sam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
DOM_SID *sid)
{
return winbind_gid_to_sid(sid, gid);
}
static bool pdb_onefs_sam_sid_to_id(struct pdb_methods *methods,
static bool pdb_wbc_sam_sid_to_id(struct pdb_methods *methods,
const DOM_SID *sid,
union unid_t *id, enum lsa_SidType *type)
{
@ -82,7 +97,7 @@ static bool pdb_onefs_sam_sid_to_id(struct pdb_methods *methods,
return true;
}
static NTSTATUS pdb_onefs_sam_enum_group_members(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_enum_group_members(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
const DOM_SID *group,
uint32 **pp_member_rids,
@ -91,7 +106,7 @@ static NTSTATUS pdb_onefs_sam_enum_group_members(struct pdb_methods *methods,
return NT_STATUS_NOT_IMPLEMENTED;
}
static NTSTATUS pdb_onefs_sam_enum_group_memberships(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_enum_group_memberships(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
struct samu *user,
DOM_SID **pp_sids,
@ -123,7 +138,7 @@ static NTSTATUS pdb_onefs_sam_enum_group_memberships(struct pdb_methods *methods
return NT_STATUS_OK;
}
static NTSTATUS pdb_onefs_sam_lookup_rids(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_lookup_rids(struct pdb_methods *methods,
const DOM_SID *domain_sid,
int num_rids,
uint32 *rids,
@ -164,23 +179,23 @@ done:
return result;
}
static NTSTATUS pdb_onefs_sam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value)
static NTSTATUS pdb_wbc_sam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value)
{
return NT_STATUS_UNSUCCESSFUL;
}
static NTSTATUS pdb_onefs_sam_set_account_policy(struct pdb_methods *methods, int policy_index, uint32 value)
static NTSTATUS pdb_wbc_sam_set_account_policy(struct pdb_methods *methods, int policy_index, uint32 value)
{
return NT_STATUS_UNSUCCESSFUL;
}
static bool pdb_onefs_sam_search_groups(struct pdb_methods *methods,
static bool pdb_wbc_sam_search_groups(struct pdb_methods *methods,
struct pdb_search *search)
{
return false;
}
static bool pdb_onefs_sam_search_aliases(struct pdb_methods *methods,
static bool pdb_wbc_sam_search_aliases(struct pdb_methods *methods,
struct pdb_search *search,
const DOM_SID *sid)
{
@ -188,7 +203,7 @@ static bool pdb_onefs_sam_search_aliases(struct pdb_methods *methods,
return false;
}
static bool pdb_onefs_sam_get_trusteddom_pw(struct pdb_methods *methods,
static bool pdb_wbc_sam_get_trusteddom_pw(struct pdb_methods *methods,
const char *domain,
char **pwd,
DOM_SID *sid,
@ -198,7 +213,7 @@ static bool pdb_onefs_sam_get_trusteddom_pw(struct pdb_methods *methods,
}
static bool pdb_onefs_sam_set_trusteddom_pw(struct pdb_methods *methods,
static bool pdb_wbc_sam_set_trusteddom_pw(struct pdb_methods *methods,
const char *domain,
const char *pwd,
const DOM_SID *sid)
@ -206,13 +221,13 @@ static bool pdb_onefs_sam_set_trusteddom_pw(struct pdb_methods *methods,
return false;
}
static bool pdb_onefs_sam_del_trusteddom_pw(struct pdb_methods *methods,
static bool pdb_wbc_sam_del_trusteddom_pw(struct pdb_methods *methods,
const char *domain)
{
return false;
}
static NTSTATUS pdb_onefs_sam_enum_trusteddoms(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_enum_trusteddoms(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
uint32 *num_domains,
struct trustdom_info ***domains)
@ -230,7 +245,7 @@ static bool _make_group_map(struct pdb_methods *methods, const char *domain, con
return true;
}
static NTSTATUS pdb_onefs_sam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
static NTSTATUS pdb_wbc_sam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
DOM_SID sid)
{
NTSTATUS result = NT_STATUS_OK;
@ -269,7 +284,7 @@ done:
return result;
}
static NTSTATUS pdb_onefs_sam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
static NTSTATUS pdb_wbc_sam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
gid_t gid)
{
NTSTATUS result = NT_STATUS_OK;
@ -309,7 +324,7 @@ done:
return result;
}
static NTSTATUS pdb_onefs_sam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
static NTSTATUS pdb_wbc_sam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
const char *name)
{
NTSTATUS result = NT_STATUS_OK;
@ -347,7 +362,7 @@ done:
return result;
}
static NTSTATUS pdb_onefs_sam_enum_group_mapping(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_enum_group_mapping(struct pdb_methods *methods,
const DOM_SID *sid, enum lsa_SidType sid_name_use,
GROUP_MAP **pp_rmap, size_t *p_num_entries,
bool unix_only)
@ -355,21 +370,21 @@ static NTSTATUS pdb_onefs_sam_enum_group_mapping(struct pdb_methods *methods,
return NT_STATUS_NOT_IMPLEMENTED;
}
static NTSTATUS pdb_onefs_sam_get_aliasinfo(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_get_aliasinfo(struct pdb_methods *methods,
const DOM_SID *sid,
struct acct_info *info)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
static NTSTATUS pdb_onefs_sam_enum_aliasmem(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_enum_aliasmem(struct pdb_methods *methods,
const DOM_SID *alias, DOM_SID **pp_members,
size_t *p_num_members)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
static NTSTATUS pdb_onefs_sam_alias_memberships(struct pdb_methods *methods,
static NTSTATUS pdb_wbc_sam_alias_memberships(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
const DOM_SID *members,
@ -384,7 +399,7 @@ static NTSTATUS pdb_onefs_sam_alias_memberships(struct pdb_methods *methods,
return NT_STATUS_OK;
}
static NTSTATUS pdb_init_onefs_sam(struct pdb_methods **pdb_method, const char *location)
static NTSTATUS pdb_init_wbc_sam(struct pdb_methods **pdb_method, const char *location)
{
NTSTATUS result;
@ -392,34 +407,34 @@ static NTSTATUS pdb_init_onefs_sam(struct pdb_methods **pdb_method, const char *
return result;
}
(*pdb_method)->name = "onefs_sam";
(*pdb_method)->name = "wbc_sam";
(*pdb_method)->getsampwnam = pdb_onefs_sam_getsampwnam;
(*pdb_method)->getsampwsid = pdb_onefs_sam_getsampwsid;
(*pdb_method)->getsampwnam = pdb_wbc_sam_getsampwnam;
(*pdb_method)->getsampwsid = pdb_wbc_sam_getsampwsid;
(*pdb_method)->getgrsid = pdb_onefs_sam_getgrsid;
(*pdb_method)->getgrgid = pdb_onefs_sam_getgrgid;
(*pdb_method)->getgrnam = pdb_onefs_sam_getgrnam;
(*pdb_method)->enum_group_mapping = pdb_onefs_sam_enum_group_mapping;
(*pdb_method)->enum_group_members = pdb_onefs_sam_enum_group_members;
(*pdb_method)->enum_group_memberships = pdb_onefs_sam_enum_group_memberships;
(*pdb_method)->get_aliasinfo = pdb_onefs_sam_get_aliasinfo;
(*pdb_method)->enum_aliasmem = pdb_onefs_sam_enum_aliasmem;
(*pdb_method)->enum_alias_memberships = pdb_onefs_sam_alias_memberships;
(*pdb_method)->lookup_rids = pdb_onefs_sam_lookup_rids;
(*pdb_method)->get_account_policy = pdb_onefs_sam_get_account_policy;
(*pdb_method)->set_account_policy = pdb_onefs_sam_set_account_policy;
(*pdb_method)->uid_to_sid = pdb_onefs_sam_uid_to_sid;
(*pdb_method)->gid_to_sid = pdb_onefs_sam_gid_to_sid;
(*pdb_method)->sid_to_id = pdb_onefs_sam_sid_to_id;
(*pdb_method)->getgrsid = pdb_wbc_sam_getgrsid;
(*pdb_method)->getgrgid = pdb_wbc_sam_getgrgid;
(*pdb_method)->getgrnam = pdb_wbc_sam_getgrnam;
(*pdb_method)->enum_group_mapping = pdb_wbc_sam_enum_group_mapping;
(*pdb_method)->enum_group_members = pdb_wbc_sam_enum_group_members;
(*pdb_method)->enum_group_memberships = pdb_wbc_sam_enum_group_memberships;
(*pdb_method)->get_aliasinfo = pdb_wbc_sam_get_aliasinfo;
(*pdb_method)->enum_aliasmem = pdb_wbc_sam_enum_aliasmem;
(*pdb_method)->enum_alias_memberships = pdb_wbc_sam_alias_memberships;
(*pdb_method)->lookup_rids = pdb_wbc_sam_lookup_rids;
(*pdb_method)->get_account_policy = pdb_wbc_sam_get_account_policy;
(*pdb_method)->set_account_policy = pdb_wbc_sam_set_account_policy;
(*pdb_method)->uid_to_sid = pdb_wbc_sam_uid_to_sid;
(*pdb_method)->gid_to_sid = pdb_wbc_sam_gid_to_sid;
(*pdb_method)->sid_to_id = pdb_wbc_sam_sid_to_id;
(*pdb_method)->search_groups = pdb_onefs_sam_search_groups;
(*pdb_method)->search_aliases = pdb_onefs_sam_search_aliases;
(*pdb_method)->search_groups = pdb_wbc_sam_search_groups;
(*pdb_method)->search_aliases = pdb_wbc_sam_search_aliases;
(*pdb_method)->get_trusteddom_pw = pdb_onefs_sam_get_trusteddom_pw;
(*pdb_method)->set_trusteddom_pw = pdb_onefs_sam_set_trusteddom_pw;
(*pdb_method)->del_trusteddom_pw = pdb_onefs_sam_del_trusteddom_pw;
(*pdb_method)->enum_trusteddoms = pdb_onefs_sam_enum_trusteddoms;
(*pdb_method)->get_trusteddom_pw = pdb_wbc_sam_get_trusteddom_pw;
(*pdb_method)->set_trusteddom_pw = pdb_wbc_sam_set_trusteddom_pw;
(*pdb_method)->del_trusteddom_pw = pdb_wbc_sam_del_trusteddom_pw;
(*pdb_method)->enum_trusteddoms = pdb_wbc_sam_enum_trusteddoms;
(*pdb_method)->private_data = NULL;
(*pdb_method)->free_private_data = NULL;
@ -427,7 +442,7 @@ static NTSTATUS pdb_init_onefs_sam(struct pdb_methods **pdb_method, const char *
return NT_STATUS_OK;
}
NTSTATUS pdb_onefs_sam_init(void)
NTSTATUS pdb_wbc_sam_init(void)
{
return smb_register_passdb(PASSDB_INTERFACE_VERSION, "onefs_sam", pdb_init_onefs_sam);
return smb_register_passdb(PASSDB_INTERFACE_VERSION, "wbc_sam", pdb_init_wbc_sam);
}

View File

@ -290,6 +290,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
"syscall_rmdir", /* PR_VALUE_SYSCALL_RMDIR */
"syscall_closedir", /* PR_VALUE_SYSCALL_CLOSEDIR */
"syscall_open", /* PR_VALUE_SYSCALL_OPEN */
"syscall_createfile", /* PR_VALUE_SYSCALL_CREATEFILE */
"syscall_close", /* PR_VALUE_SYSCALL_CLOSE */
"syscall_read", /* PR_VALUE_SYSCALL_READ */
"syscall_pread", /* PR_VALUE_SYSCALL_PREAD */
@ -299,6 +300,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
"syscall_sendfile", /* PR_VALUE_SYSCALL_SENDFILE */
"syscall_recvfile", /* PR_VALUE_SYSCALL_RECVFILE */
"syscall_rename", /* PR_VALUE_SYSCALL_RENAME */
"syscall_rename_at", /* PR_VALUE_SYSCALL_RENAME_AT */
"syscall_fsync", /* PR_VALUE_SYSCALL_FSYNC */
"syscall_stat", /* PR_VALUE_SYSCALL_STAT */
"syscall_fstat", /* PR_VALUE_SYSCALL_FSTAT */
@ -323,6 +325,11 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
"syscall_realpath", /* PR_VALUE_SYSCALL_REALPATH */
"syscall_get_quota", /* PR_VALUE_SYSCALL_GET_QUOTA */
"syscall_set_quota", /* PR_VALUE_SYSCALL_SET_QUOTA */
"syscall_get_sd", /* PR_VALUE_SYSCALL_GET_SD */
"syscall_set_sd", /* PR_VALUE_SYSCALL_SET_SD */
"syscall_brl_lock", /* PR_VALUE_SYSCALL_BRL_LOCK */
"syscall_brl_unlock", /* PR_VALUE_SYSCALL_BRL_UNLOCK */
"syscall_brl_cancel", /* PR_VALUE_SYSCALL_BRL_CANCEL */
"SMBmkdir", /* PR_VALUE_SMBMKDIR */
"SMBrmdir", /* PR_VALUE_SMBRMDIR */
"SMBopen", /* PR_VALUE_SMBOPEN */

View File

@ -3100,288 +3100,6 @@ bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u,
return True;
}
/*******************************************************************
********************************************************************/
bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u,
prs_struct *ps, int depth)
{
SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il;
prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_3");
depth++;
/* reading */
if (UNMARSHALLING(ps)) {
il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3,1);
if(il == NULL)
return False;
*q_u=il;
}
else {
il=*q_u;
}
if(!prs_align(ps))
return False;
if(!prs_uint32("cversion", ps, depth, &il->cversion))
return False;
if(!prs_uint32("name", ps, depth, &il->name_ptr))
return False;
if(!prs_uint32("environment", ps, depth, &il->environment_ptr))
return False;
if(!prs_uint32("driverpath", ps, depth, &il->driverpath_ptr))
return False;
if(!prs_uint32("datafile", ps, depth, &il->datafile_ptr))
return False;
if(!prs_uint32("configfile", ps, depth, &il->configfile_ptr))
return False;
if(!prs_uint32("helpfile", ps, depth, &il->helpfile_ptr))
return False;
if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr))
return False;
if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr))
return False;
if(!prs_uint32("dependentfilessize", ps, depth, &il->dependentfilessize))
return False;
if(!prs_uint32("dependentfiles", ps, depth, &il->dependentfiles_ptr))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
return False;
if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth))
return False;
if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth))
return False;
if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth))
return False;
if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth))
return False;
if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth))
return False;
if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth))
return False;
if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if (il->dependentfiles_ptr)
smb_io_buffer5("", &il->dependentfiles, ps, depth);
return True;
}
/*******************************************************************
parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
********************************************************************/
bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u,
prs_struct *ps, int depth)
{
SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il;
prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_6");
depth++;
/* reading */
if (UNMARSHALLING(ps)) {
il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6,1);
if(il == NULL)
return False;
*q_u=il;
}
else {
il=*q_u;
}
if(!prs_align(ps))
return False;
/*
* I know this seems weird, but I have no other explanation.
* This is observed behavior on both NT4 and 2K servers.
* --jerry
*/
if (!prs_align_uint64(ps))
return False;
/* parse the main elements the packet */
if(!prs_uint32("cversion ", ps, depth, &il->version))
return False;
if(!prs_uint32("name ", ps, depth, &il->name_ptr))
return False;
if(!prs_uint32("environment ", ps, depth, &il->environment_ptr))
return False;
if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr))
return False;
if(!prs_uint32("datafile ", ps, depth, &il->datafile_ptr))
return False;
if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr))
return False;
if(!prs_uint32("helpfile ", ps, depth, &il->helpfile_ptr))
return False;
if(!prs_uint32("monitorname ", ps, depth, &il->monitorname_ptr))
return False;
if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr))
return False;
if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_len))
return False;
if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_ptr))
return False;
if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_len))
return False;
if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_ptr))
return False;
if(!smb_io_time("driverdate ", &il->driverdate, ps, depth))
return False;
if(!prs_uint32("dummy4 ", ps, depth, &il->dummy4))
return False;
if(!prs_uint64("driverversion ", ps, depth, &il->driverversion))
return False;
if(!prs_uint32("mfgname ", ps, depth, &il->mfgname_ptr))
return False;
if(!prs_uint32("oemurl ", ps, depth, &il->oemurl_ptr))
return False;
if(!prs_uint32("hardwareid ", ps, depth, &il->hardwareid_ptr))
return False;
if(!prs_uint32("provider ", ps, depth, &il->provider_ptr))
return False;
/* parse the structures in the packet */
if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if (il->dependentfiles_ptr) {
if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth))
return False;
if(!prs_align(ps))
return False;
}
if (il->previousnames_ptr) {
if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth))
return False;
if(!prs_align(ps))
return False;
}
if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("oemurl", &il->oemurl, il->oemurl_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("hardwareid", &il->hardwareid, il->hardwareid_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth))
return False;
return True;
}
/*******************************************************************
read a UNICODE array with null terminated strings
and null terminated array
and size of array at beginning
********************************************************************/
bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth)
{
if (buffer==NULL) return False;
buffer->offset=0;
buffer->uni_str_len=buffer->uni_max_len;
if(!prs_uint32("buffer_size", ps, depth, &buffer->uni_max_len))
return False;
if(!prs_unistr2(True, "buffer ", ps, depth, buffer))
return False;
return True;
}
/*******************************************************************
********************************************************************/
bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level");
depth++;
if(!prs_align(ps))
return False;
if(!prs_uint32("level", ps, depth, &il->level))
return False;
if(!prs_uint32("ptr", ps, depth, &il->ptr))
return False;
if (il->ptr==0)
return True;
switch (il->level) {
case 3:
if(!spool_io_printer_driver_info_level_3("", &il->info_3, ps, depth))
return False;
break;
case 6:
if(!spool_io_printer_driver_info_level_6("", &il->info_6, ps, depth))
return False;
break;
default:
return False;
}
return True;
}
/*******************************************************************
make a BUFFER5 struct from a uint16*
******************************************************************/
@ -3406,48 +3124,6 @@ bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16
return True;
}
/*******************************************************************
fill in the prs_struct for a ADDPRINTERDRIVER request PDU
********************************************************************/
bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver");
depth++;
if(!prs_align(ps))
return False;
if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr))
return False;
if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth))
return False;
if(!prs_align(ps))
return False;
if(!prs_uint32("info_level", ps, depth, &q_u->level))
return False;
if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth))
return False;
return True;
}
/*******************************************************************
********************************************************************/
bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver");
depth++;
if(!prs_werror("status", ps, depth, &q_u->status))
return False;
return True;
}
/*******************************************************************
********************************************************************/

View File

@ -4,6 +4,7 @@
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
# Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
#
# Based on the original in EJS:
# Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
@ -100,8 +101,6 @@ class ProvisionPaths(object):
self.olcdir = None
self.olslaptest = None
self.olcseedldif = None
self.olcsyncprovdir = None
self.olcsyncprovfile = None
class ProvisionNames(object):
@ -278,10 +277,6 @@ def provision_paths_from_lp(lp, dnsdomain):
"slapd.d")
paths.olcseedldif = os.path.join(paths.ldapdir,
"olc_seed.ldif")
paths.olcsyncprovdir = os.path.join(paths.olcdir,
"cn=config/olcDatabase={0}config")
paths.olcsyncprovfile = os.path.join(paths.olcsyncprovdir,
"olcOverlay={0}syncprov.ldif")
paths.hklm = "hklm.ldb"
paths.hkcr = "hkcr.ldb"
paths.hkcu = "hkcu.ldb"
@ -1479,7 +1474,7 @@ def provision_backend(setup_dir=None, message=None,
slapdcommand="Start slapd with: slapd -F " + paths.olcdir + " -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
if ol_olc != "yes" and ol_mmr_urls is not None:
slapdcommand="Start slapd with: slapd -F " + paths.ldapdir + "/slapd.conf -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
slapdcommand="Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
if ol_olc == "yes" and ol_mmr_urls is not None:
slapdcommand="Start slapd with: slapd -F " + paths.olcdir + " -h \"" + ldapi_uri + " ldap://<FQHN>:<PORT>\""
@ -1505,6 +1500,8 @@ def provision_backend(setup_dir=None, message=None,
message("LDAP admin password: %s" % adminpass)
message(slapdcommand)
if ol_olc == "yes" or ol_mmr_urls is not None:
message("Attention to slapd-Port: <PORT> must be different than 389!")
assert isinstance(ldap_backend_type, str)
assert isinstance(ldapuser, str)
assert isinstance(adminpass, str)
@ -1528,19 +1525,10 @@ def provision_backend(setup_dir=None, message=None,
paths.olslaptest = str(ol_slaptest)
olc_command = paths.olslaptest + " -f" + paths.slapdconf + " -F" + paths.olcdir + " >/dev/null 2>&1"
os.system(olc_command)
#os.remove(paths.slapdconf)
# use line below for debugging during olc-conversion with slaptest
os.remove(paths.slapdconf)
# use line below for debugging during olc-conversion with slaptest, instead of olc_command above
#olc_command = paths.olslaptest + " -f" + paths.slapdconf + " -F" + paths.olcdir"
# workaround, if overlay syncprov is was not created properly during conversion to cn=config.
# otherwise, cn=config won't be replicated
if ol_olc == "yes" and ol_mmr_urls is not None:
if not os.path.exists(paths.olcsyncprovdir):
os.makedirs(paths.olcsyncprovdir, 0770)
setup_file(setup_path("olcOverlay={0}syncprov.ldif"),
os.path.join(paths.olcsyncprovdir, "olcOverlay={0}syncprov.ldif"), {})
def create_phpldapadmin_config(path, setup_path, ldapi_uri):
"""Create a PHP LDAP admin configuration file.

View File

@ -1,11 +0,0 @@
dn: olcOverlay={0}syncprov
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: {0}syncprov
structuralObjectClass: olcSyncProvConfig
entryUUID: 41df5aca-785a-102d-9077-999999999999
creatorsName: cn=config
createTimestamp: 20090116201111Z
entryCSN: 20090116201111.111111Z#000000#000#000000
modifiersName: cn=config
modifyTimestamp: 20090116201111Z

View File

@ -4,6 +4,7 @@
# provision a Samba4 server
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
# Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
#
# Based on the original in EJS:
# Copyright (C) Andrew Tridgell 2005
@ -65,9 +66,9 @@ parser.add_option("--server-role", type="choice", metavar="ROLE",
parser.add_option("--targetdir", type="string", metavar="DIR",
help="Set target directory")
parser.add_option("--ol-mmr-urls", type="string", metavar="LDAPSERVER",
help="List of LDAP-URLS [ ldap://<FQDN>:port/ (where port != 389) ] separated with whitespaces for use with OpenLDAP-MMR (Multi-Master-Replication)")
help="List of LDAP-URLS [ ldap://<FQHN>:<PORT>/ (where <PORT> has to be different from 389!) ] separated with whitespaces for use with OpenLDAP-MMR (Multi-Master-Replication)")
parser.add_option("--ol-olc", type="choice", metavar="OPENLDAP-OLC",
help="To setup OpenLDAP-Backend with Online-Configuration [slapd.d] choose 'yes'",
help="To setup OpenLDAP-Backend with Online-Configuration [slapd.d] choose 'yes'. Note: Only OpenLDAP-Versions greater or equal 2.4.15 should be used!",
choices=["yes", "no"])
parser.add_option("--ol-slaptest", type="string", metavar="SLAPTEST-PATH",
help="Path to slaptest-binary [e.g.:'/usr/local/sbin']. Only for use with --ol-olc='yes'")