diff options
author | as200622 <none@none> | 2008-01-05 20:52:22 -0800 |
---|---|---|
committer | as200622 <none@none> | 2008-01-05 20:52:22 -0800 |
commit | dc20a3024900c47dd2ee44b9707e6df38f7d62a5 (patch) | |
tree | e0957e6b6d6b5c0117800046c765b78d69f80ce1 /usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c | |
parent | bda89588bd7667394a834e8a9a34612cce2ae9c3 (diff) | |
download | illumos-gate-dc20a3024900c47dd2ee44b9707e6df38f7d62a5.tar.gz |
6560095 SNAS shows SIDs for Built-in Groups members instead of name
6582153 SMB signing and sealing (redirector)
6582192 Remove SMB config cache
6582210 Consistent Logging Strategy
6582214 Unified error reporting strategy
6593360 Confusing log message: [ID 334764 user.error] Ads is not enable
6597854 The shares are not accessible if doing Run \\ip-addr
6610587 RPC-WINREG test has failed on smbtorture.
6610650 Workgroup: authentication problem when client's LM level > 2
6611277 Should not be able to join domain when Snas ipc-mode=anon and W2K DC IPC=No access without anonymous
6613675 Creating a file with DOS readonly bit set requires special handling
6626113 libshare_smb leaks file descriptor on unload
6626119 libshare_smb leaks file descriptor on door call failure
6626126 libsmb configuration leaks memory
6629314 smbd logging forgets newlines, creating a mess
6629954 smb local group support should be re-enabled
6630424 libshare having trouble starting smb/server
6631739 rdr_ipcmode does change to "Fallback,anon".
6631985 SMB daemon doesn't locate a new ADS server if ads_site property has been modified.
6631987 SMB daemon reads /etc/resolv.conf once when it starts up.
6633202 smbfs client caused CIFS server panic
6635175 lint error reported when building smbsrv module when either mars or ceres lint was used
6636763 Get core if using sharemgr set-share -r with nonexistent share
6640934 libshare tries to enable smb service if any filesystem is shared over smb
6641051 The CIFS server needs to use the VFS nbmand mechanism for system-wide share reservations
6642047 Changes to SMF properties of the CIFS service - PSARC/2007/686
6642302 Do not add null when marshalling non-null-terminated NDR strings
6642368 Cross protocol byte range locking is needed
--HG--
rename : usr/src/lib/smbsrv/libmlsvc/common/mlsvc_handle.c => deleted_files/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_handle.c
rename : usr/src/lib/smbsrv/libsmb/common/smb_group_door_encdec.c => deleted_files/usr/src/lib/smbsrv/libsmb/common/smb_group_door_encdec.c
rename : usr/src/lib/smbsrv/libsmb/common/smb_group_xdr.c => deleted_files/usr/src/lib/smbsrv/libsmb/common/smb_group_xdr.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlrpc_client.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_client.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlrpc_heap.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_heap.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlrpc_encdec.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_marshal.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlndo.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_ops.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlndr.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_process.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlrpc_server.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_server.c
rename : usr/src/lib/smbsrv/libmlrpc/common/mlrpc_svc.c => usr/src/lib/smbsrv/libmlrpc/common/ndr_svc.c
Diffstat (limited to 'usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c')
-rw-r--r-- | usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c | 377 |
1 files changed, 1 insertions, 376 deletions
diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c b/usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c index 1f5083f448..4460e70154 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_scfutil.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -60,95 +60,6 @@ smb_smf_scf_log_error(char *msg) } /* - * Check if instance with given name exists for a service. - * Returns 0 is instance exist - */ -int -smb_smf_instance_exists(smb_scfhandle_t *handle, char *inst_name) -{ - int ret = SMBD_SMF_OK; - if (handle == NULL) - return (SMBD_SMF_SYSTEM_ERR); - - handle->scf_instance = scf_instance_create(handle->scf_handle); - if (scf_service_get_instance(handle->scf_service, inst_name, - handle->scf_instance) != SCF_SUCCESS) - ret = SMBD_SMF_SYSTEM_ERR; - - scf_instance_destroy(handle->scf_instance); - handle->scf_instance = NULL; - return (ret); -} - -/* - * Create a service instance. returns 0 if successful. - * If instance already exists enable it. - */ -int -smb_smf_instance_create(smb_scfhandle_t *handle, char *serv_prefix, - char *inst_name) -{ - char *instance; - int ret = SMBD_SMF_OK; - int sz; - - if (handle == NULL) - return (SMBD_SMF_SYSTEM_ERR); - - if (!serv_prefix || !inst_name) - return (SMBD_SMF_SYSTEM_ERR); - - sz = strlen(serv_prefix) + strlen(inst_name) + 2; - instance = malloc(sz); - if (!instance) - return (SMBD_SMF_NO_MEMORY); - - (void) snprintf(instance, sz, "%s:%s", serv_prefix, inst_name); - handle->scf_instance = scf_instance_create(handle->scf_handle); - if (scf_service_get_instance(handle->scf_service, inst_name, - handle->scf_instance) != SCF_SUCCESS) { - if (scf_service_add_instance(handle->scf_service, - inst_name, handle->scf_instance) == SCF_SUCCESS) { - if (smf_enable_instance(instance, 0)) - ret = SMBD_SMF_SYSTEM_ERR; - } else { - ret = SMBD_SMF_SYSTEM_ERR; - } - } else { - if (smf_enable_instance(instance, 0)) - ret = SMBD_SMF_SYSTEM_ERR; - } - free(instance); - return (ret); -} - -/* - * Delete a specified instance. Return SMBD_SMF_OK for success. - */ -int -smb_smf_instance_delete(smb_scfhandle_t *handle, char *inst_name) -{ - int ret = SMBD_SMF_OK; - - if (handle == NULL) - return (SMBD_SMF_SYSTEM_ERR); - - handle->scf_instance = scf_instance_create(handle->scf_handle); - if (scf_service_get_instance(handle->scf_service, inst_name, - handle->scf_instance) == SCF_SUCCESS) { - if (scf_instance_delete(handle->scf_instance) == SCF_SUCCESS) { - return (ret); - } else { - ret = SMBD_SMF_SYSTEM_ERR; - } - } else { - smb_smf_scf_log_error(NULL); - ret = SMBD_SMF_SYSTEM_ERR; - } - return (ret); -} - -/* * smb_smf_create_service_pgroup(handle, pgroup) * * create a new property group at service level. @@ -196,152 +107,6 @@ smb_smf_create_service_pgroup(smb_scfhandle_t *handle, char *pgroup) } /* - * smb_smf_create_instance_pgroup(handle, pgroup) - * - * create a new property group at instance level. - */ -int -smb_smf_create_instance_pgroup(smb_scfhandle_t *handle, char *pgroup) -{ - int ret = SMBD_SMF_OK; - int err; - - if (handle == NULL) { - return (SMBD_SMF_SYSTEM_ERR); - } - - /* - * only create a handle if it doesn't exist. It is ok to exist - * since the pg handle will be set as a side effect. - */ - if (handle->scf_pg == NULL) - handle->scf_pg = scf_pg_create(handle->scf_handle); - - /* - * if the pgroup exists, we are done. If it doesn't, then we - * need to actually add one to the service instance. - */ - if (scf_instance_get_pg(handle->scf_instance, - pgroup, handle->scf_pg) != 0) { - /* doesn't exist so create one */ - if (scf_instance_add_pg(handle->scf_instance, pgroup, - SCF_GROUP_FRAMEWORK, 0, handle->scf_pg) != 0) { - err = scf_error(); - if (err != SCF_ERROR_NONE) - smb_smf_scf_log_error(NULL); - switch (err) { - case SCF_ERROR_PERMISSION_DENIED: - ret = SMBD_SMF_NO_PERMISSION; - break; - default: - ret = SMBD_SMF_SYSTEM_ERR; - break; - } - } - } - return (ret); -} - -/* - * smb_smf_delete_service_pgroup(handle, pgroup) - * - * remove the property group from the current service. - * but only if it actually exists. - */ -int -smb_smf_delete_service_pgroup(smb_scfhandle_t *handle, char *pgroup) -{ - int ret = SMBD_SMF_OK; - int err; - - if (handle == NULL) { - return (SMBD_SMF_SYSTEM_ERR); - } - - /* - * only create a handle if it doesn't exist. It is ok to exist - * since the pg handle will be set as a side effect. - */ - if (handle->scf_pg == NULL) - handle->scf_pg = scf_pg_create(handle->scf_handle); - - /* - * only delete if it does exist. - */ - if (scf_service_get_pg(handle->scf_service, - pgroup, handle->scf_pg) == 0) { - /* does exist so delete it */ - if (scf_pg_delete(handle->scf_pg) != 0) { - ret = SMBD_SMF_SYSTEM_ERR; - err = scf_error(); - if (err != SCF_ERROR_NONE) { - smb_smf_scf_log_error("SMF delpg " - "problem: %s\n"); - } - } - } else { - err = scf_error(); - if (err != SCF_ERROR_NONE) - smb_smf_scf_log_error("SMF getpg problem: %s\n"); - ret = SMBD_SMF_SYSTEM_ERR; - } - if (ret == SMBD_SMF_SYSTEM_ERR && - scf_error() == SCF_ERROR_PERMISSION_DENIED) { - ret = SMBD_SMF_NO_PERMISSION; - } - return (ret); -} - -/* - * smb_smf_delete_instance_pgroup(handle, pgroup) - * - * remove the property group from the current instance. - * but only if it actually exists. - */ -int -smb_smf_delete_instance_pgroup(smb_scfhandle_t *handle, char *pgroup) -{ - int ret = SMBD_SMF_OK; - int err; - - if (handle == NULL) - return (SMBD_SMF_SYSTEM_ERR); - - /* - * only create a handle if it doesn't exist. It is ok to exist - * since the pg handle will be set as a side effect. - */ - if (handle->scf_pg == NULL) - handle->scf_pg = scf_pg_create(handle->scf_handle); - - /* - * only delete if it does exist. - */ - if (scf_instance_get_pg(handle->scf_instance, - pgroup, handle->scf_pg) == 0) { - /* does exist so delete it */ - if (scf_pg_delete(handle->scf_pg) != 0) { - ret = SMBD_SMF_SYSTEM_ERR; - err = scf_error(); - if (err != SCF_ERROR_NONE) { - smb_smf_scf_log_error("SMF delpg " - "problem: %s\n"); - } - } - } else { - err = scf_error(); - if (err != SCF_ERROR_NONE) - smb_smf_scf_log_error("SMF getpg problem: %s\n"); - ret = SMBD_SMF_SYSTEM_ERR; - } - if (ret == SMBD_SMF_SYSTEM_ERR && - scf_error() == SCF_ERROR_PERMISSION_DENIED) - ret = SMBD_SMF_NO_PERMISSION; - - return (ret); -} - -/* * Start transaction on current pg in handle. * The pg could be service or instance level. * Must be called after pg handle is obtained @@ -413,49 +178,6 @@ smb_smf_end_transaction(smb_scfhandle_t *handle) } /* - * Deletes property in current pg - */ -int -smb_smf_delete_property(smb_scfhandle_t *handle, char *propname) -{ - int ret = SMBD_SMF_OK; - scf_transaction_entry_t *entry = NULL; - - if (handle == NULL) - return (SMBD_SMF_SYSTEM_ERR); - - /* - * properties must be set in transactions and don't take - * effect until the transaction has been ended/committed. - */ - entry = scf_entry_create(handle->scf_handle); - if (entry != NULL) { - if (scf_transaction_property_delete(handle->scf_trans, entry, - propname) != 0) { - ret = SMBD_SMF_SYSTEM_ERR; - } - } else { - ret = SMBD_SMF_SYSTEM_ERR; - } - if (ret == SMBD_SMF_SYSTEM_ERR) { - switch (scf_error()) { - case SCF_ERROR_PERMISSION_DENIED: - ret = SMBD_SMF_NO_PERMISSION; - break; - } - } - - /* - * cleanup if there were any errors that didn't leave these - * values where they would be cleaned up later. - */ - if ((ret != SMBD_SMF_OK) && (entry != NULL)) - scf_entry_destroy(entry); - - return (ret); -} - -/* * Sets string property in current pg */ int @@ -843,103 +565,6 @@ smb_smf_get_opaque_property(smb_scfhandle_t *handle, char *propname, } /* - * Get property based on property type. Returns string value of that - * property. Only SCF_TYPE_ASTRING, SCF_TYPE_INTEGER, SCF_TYPE_BOOLEAN - * supported. - */ -int -smb_smf_get_property(smb_scfhandle_t *handle, int proptype, char *propname, - char *valstr, size_t sz) -{ - int64_t valint = 0; - uint8_t valbool = 0; - int ret = SMBD_SMF_OK; - - switch (proptype) { - case SCF_TYPE_ASTRING: - ret = smb_smf_get_string_property(handle, propname, - valstr, sz); - break; - case SCF_TYPE_INTEGER: - if ((ret = smb_smf_get_integer_property(handle, propname, - &valint)) != 0) - return (ret); - (void) snprintf(valstr, sz, "%lld", valint); - break; - case SCF_TYPE_BOOLEAN: - if ((ret = smb_smf_get_boolean_property(handle, propname, - &valbool)) != 0) - return (ret); - (void) strlcpy(valstr, (valbool ? "true" : "false"), sz); - break; - default: - return (SMBD_SMF_SYSTEM_ERR); - } - return (ret); -} - -/* - * Set property based on property type. - * Only SCF_TYPE_ASTRING, SCF_TYPE_INTEGER, SCF_TYPE_BOOLEAN supported. - */ -int -smb_smf_set_property(smb_scfhandle_t *handle, int proptype, - char *propname, char *valstr) -{ - int64_t valint = 0; - uint8_t valbool = 0; - int ret = SMBD_SMF_OK; - - switch (proptype) { - case SCF_TYPE_ASTRING: - ret = smb_smf_set_string_property(handle, propname, - valstr); - break; - case SCF_TYPE_INTEGER: - valint = strtol(valstr, 0, 10); - ret = smb_smf_set_integer_property(handle, propname, - valint); - break; - case SCF_TYPE_BOOLEAN: - if (strcasecmp(valstr, "true") == 0) - valbool = 1; - ret = smb_smf_set_boolean_property(handle, propname, valbool); - break; - default: - return (SMBD_SMF_SYSTEM_ERR); - } - return (ret); -} - -/* - * Gets an instance iterator for the service specified. - */ -smb_scfhandle_t * -smb_smf_get_iterator(char *svc_name) -{ - smb_scfhandle_t *handle = NULL; - - handle = smb_smf_scf_init(svc_name); - if (!handle) - return (NULL); - - handle->scf_inst_iter = scf_iter_create(handle->scf_handle); - if (handle->scf_inst_iter) { - if (scf_iter_service_instances(handle->scf_inst_iter, - handle->scf_service) != 0) { - smb_smf_scf_fini(handle); - handle = NULL; - } else { - handle->scf_instance = NULL; - } - } else { - smb_smf_scf_fini(handle); - handle = NULL; - } - return (handle); -} - -/* * smb_smf_scf_init() * * must be called before using any of the SCF functions. |