summaryrefslogtreecommitdiff
path: root/source4/ntvfs/unixuid
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-03 07:31:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:34 -0500
commitc5722fb81b14bf067c4c97eda2ee01f1640084f7 (patch)
tree5d50dfded1d35d6d5b85326f3a3bc546120c3ac8 /source4/ntvfs/unixuid
parent68d2ce3320a5ad33c08a705cb5f551a21efa611e (diff)
downloadsamba-c5722fb81b14bf067c4c97eda2ee01f1640084f7.tar.gz
samba-c5722fb81b14bf067c4c97eda2ee01f1640084f7.tar.bz2
samba-c5722fb81b14bf067c4c97eda2ee01f1640084f7.zip
r2796: - changed ldap attributes "UnixID" to "unixID" and "UnixName" to "unixName" to be more ldap traditional
- register the unixuid module as all 3 ntvfs backend types, as it doesn't care what type of backend it filters (This used to be commit cd43def6ce280442306f14ca61508b4f7eb92cb6)
Diffstat (limited to 'source4/ntvfs/unixuid')
-rw-r--r--source4/ntvfs/unixuid/vfs_unixuid.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c
index 6eef6dbc37..de759f6e5f 100644
--- a/source4/ntvfs/unixuid/vfs_unixuid.c
+++ b/source4/ntvfs/unixuid/vfs_unixuid.c
@@ -35,7 +35,7 @@ static NTSTATUS sid_to_unixuid(struct ntvfs_module_context *ntvfs,
struct smbsrv_request *req, struct dom_sid *sid, uid_t *uid)
{
struct unixuid_private *private = ntvfs->private_data;
- const char *attrs[] = { "sAMAccountName", "UnixID", "UnixName", "sAMAccountType", NULL };
+ const char *attrs[] = { "sAMAccountName", "unixID", "unixName", "sAMAccountType", NULL };
int ret;
const char *s;
void *ctx;
@@ -47,7 +47,7 @@ static NTSTATUS sid_to_unixuid(struct ntvfs_module_context *ntvfs,
ret = samdb_search(private->samctx, ctx, NULL, &res, attrs, "objectSid=%s", sidstr);
if (ret != 1) {
- DEBUG(2,("Unable to map sid %s to unix uid\n", sidstr));
+ DEBUG(0,("sid_to_unixuid: unable to find sam record for sid %s\n", sidstr));
talloc_free(ctx);
return NT_STATUS_ACCESS_DENIED;
}
@@ -60,7 +60,7 @@ static NTSTATUS sid_to_unixuid(struct ntvfs_module_context *ntvfs,
}
/* first try to get the uid directly */
- s = samdb_result_string(res[0], "UnixID", NULL);
+ s = samdb_result_string(res[0], "unixID", NULL);
if (s != NULL) {
*uid = strtoul(s, NULL, 0);
talloc_free(ctx);
@@ -68,11 +68,11 @@ static NTSTATUS sid_to_unixuid(struct ntvfs_module_context *ntvfs,
}
/* next try via the UnixName attribute */
- s = samdb_result_string(res[0], "UnixName", NULL);
+ s = samdb_result_string(res[0], "unixName", NULL);
if (s != NULL) {
struct passwd *pwd = getpwnam(s);
if (!pwd) {
- DEBUG(0,("UnixName %s for sid %s does not exist as a local user\n", s, sidstr));
+ DEBUG(0,("unixName %s for sid %s does not exist as a local user\n", s, sidstr));
talloc_free(ctx);
return NT_STATUS_ACCESS_DENIED;
}
@@ -109,7 +109,7 @@ static NTSTATUS sid_to_unixgid(struct ntvfs_module_context *ntvfs,
struct smbsrv_request *req, struct dom_sid *sid, gid_t *gid)
{
struct unixuid_private *private = ntvfs->private_data;
- const char *attrs[] = { "sAMAccountName", "UnixID", "UnixName", "sAMAccountType", NULL };
+ const char *attrs[] = { "sAMAccountName", "unixID", "unixName", "sAMAccountType", NULL };
int ret;
const char *s;
void *ctx;
@@ -121,7 +121,7 @@ static NTSTATUS sid_to_unixgid(struct ntvfs_module_context *ntvfs,
ret = samdb_search(private->samctx, ctx, NULL, &res, attrs, "objectSid=%s", sidstr);
if (ret != 1) {
- DEBUG(2,("Unable to map sid %s to unix gid\n", sidstr));
+ DEBUG(0,("sid_to_unixgid: unable to find sam record for sid %s\n", sidstr));
talloc_free(ctx);
return NT_STATUS_ACCESS_DENIED;
}
@@ -134,7 +134,7 @@ static NTSTATUS sid_to_unixgid(struct ntvfs_module_context *ntvfs,
}
/* first try to get the gid directly */
- s = samdb_result_string(res[0], "UnixID", NULL);
+ s = samdb_result_string(res[0], "unixID", NULL);
if (s != NULL) {
*gid = strtoul(s, NULL, 0);
talloc_free(ctx);
@@ -142,11 +142,11 @@ static NTSTATUS sid_to_unixgid(struct ntvfs_module_context *ntvfs,
}
/* next try via the UnixName attribute */
- s = samdb_result_string(res[0], "UnixName", NULL);
+ s = samdb_result_string(res[0], "unixName", NULL);
if (s != NULL) {
struct group *grp = getgrnam(s);
if (!grp) {
- DEBUG(0,("UnixName '%s' for sid %s does not exist as a local group\n", s, sidstr));
+ DEBUG(0,("unixName '%s' for sid %s does not exist as a local group\n", s, sidstr));
talloc_free(ctx);
return NT_STATUS_ACCESS_DENIED;
}
@@ -708,10 +708,6 @@ NTSTATUS ntvfs_unixuid_init(void)
ZERO_STRUCT(ops);
- /* fill in the name and type */
- ops.name = "unixuid";
- ops.type = NTVFS_DISK;
-
/* fill in all the operations */
ops.connect = unixuid_connect;
ops.disconnect = unixuid_disconnect;
@@ -742,12 +738,21 @@ NTSTATUS ntvfs_unixuid_init(void)
ops.trans = unixuid_trans;
ops.logoff = unixuid_logoff;
- /* register ourselves with the NTVFS subsystem. */
+ ops.name = "unixuid";
+
+ /* we register under all 3 backend types, as we are not type specific */
+ ops.type = NTVFS_DISK;
ret = register_backend("ntvfs", &ops);
+ if (!NT_STATUS_IS_OK(ret)) goto failed;
- if (!NT_STATUS_IS_OK(ret)) {
- DEBUG(0,("Failed to register unixuid backend!\n"));
- }
+ ops.type = NTVFS_PRINT;
+ ret = register_backend("ntvfs", &ops);
+ if (!NT_STATUS_IS_OK(ret)) goto failed;
+
+ ops.type = NTVFS_IPC;
+ ret = register_backend("ntvfs", &ops);
+ if (!NT_STATUS_IS_OK(ret)) goto failed;
+failed:
return ret;
}