summaryrefslogtreecommitdiff
path: root/source3/lib/netapi
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-08-12 15:25:06 +0200
committerGünther Deschner <gd@samba.org>2008-08-14 12:22:02 +0200
commit87b9c9ade21a68d4428ff4aadd32f02f86e78a40 (patch)
tree54daeef1faa31c9f6ac5fc6743c5747ae72d4a44 /source3/lib/netapi
parenta810cc865d40aff7dbe123ac5217d8b4b38c95e5 (diff)
downloadsamba-87b9c9ade21a68d4428ff4aadd32f02f86e78a40.tar.gz
samba-87b9c9ade21a68d4428ff4aadd32f02f86e78a40.tar.bz2
samba-87b9c9ade21a68d4428ff4aadd32f02f86e78a40.zip
netapi: make non-implemented local calls default to remote "localhost" calls.
Guenther (cherry picked from commit aa70e588803e3767796dc958b139f4ee464d8626) (This used to be commit 9927ac6eec9fe1fecfedb97b61c4f93379fc8722)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r--source3/lib/netapi/getdc.c4
-rw-r--r--source3/lib/netapi/group.c16
-rw-r--r--source3/lib/netapi/localgroup.c18
-rw-r--r--source3/lib/netapi/netapi_private.h7
-rw-r--r--source3/lib/netapi/serverinfo.c2
-rw-r--r--source3/lib/netapi/user.c26
6 files changed, 35 insertions, 38 deletions
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c
index 4636042431..82fa35d4a1 100644
--- a/source3/lib/netapi/getdc.c
+++ b/source3/lib/netapi/getdc.c
@@ -31,7 +31,7 @@
WERROR NetGetDCName_l(struct libnetapi_ctx *ctx,
struct NetGetDCName *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGetDCName);
}
/********************************************************************
@@ -72,7 +72,7 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
WERROR NetGetAnyDCName_l(struct libnetapi_ctx *ctx,
struct NetGetAnyDCName *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGetAnyDCName);
}
/********************************************************************
diff --git a/source3/lib/netapi/group.c b/source3/lib/netapi/group.c
index 30ff6af2f0..e057e6de02 100644
--- a/source3/lib/netapi/group.c
+++ b/source3/lib/netapi/group.c
@@ -220,7 +220,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
WERROR NetGroupAdd_l(struct libnetapi_ctx *ctx,
struct NetGroupAdd *r)
{
- return NetGroupAdd_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupAdd);
}
/****************************************************************
@@ -390,7 +390,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
WERROR NetGroupDel_l(struct libnetapi_ctx *ctx,
struct NetGroupDel *r)
{
- return NetGroupDel_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupDel);
}
/****************************************************************
@@ -578,7 +578,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetGroupSetInfo_l(struct libnetapi_ctx *ctx,
struct NetGroupSetInfo *r)
{
- return NetGroupSetInfo_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupSetInfo);
}
/****************************************************************
@@ -766,7 +766,7 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetGroupGetInfo_l(struct libnetapi_ctx *ctx,
struct NetGroupGetInfo *r)
{
- return NetGroupGetInfo_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupGetInfo);
}
/****************************************************************
@@ -896,7 +896,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
WERROR NetGroupAddUser_l(struct libnetapi_ctx *ctx,
struct NetGroupAddUser *r)
{
- return NetGroupAddUser_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupAddUser);
}
/****************************************************************
@@ -1025,7 +1025,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
WERROR NetGroupDelUser_l(struct libnetapi_ctx *ctx,
struct NetGroupDelUser *r)
{
- return NetGroupDelUser_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupDelUser);
}
/****************************************************************
@@ -1304,7 +1304,7 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
WERROR NetGroupEnum_l(struct libnetapi_ctx *ctx,
struct NetGroupEnum *r)
{
- return NetGroupEnum_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupEnum);
}
/****************************************************************
@@ -1322,5 +1322,5 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
WERROR NetGroupGetUsers_l(struct libnetapi_ctx *ctx,
struct NetGroupGetUsers *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetGroupGetUsers);
}
diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c
index 6fe5f1cd86..811e7e8ab6 100644
--- a/source3/lib/netapi/localgroup.c
+++ b/source3/lib/netapi/localgroup.c
@@ -253,7 +253,7 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupAdd_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupAdd *r)
{
- return NetLocalGroupAdd_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupAdd);
}
/****************************************************************
@@ -378,7 +378,7 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupDel_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupDel *r)
{
- return NetLocalGroupDel_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupDel);
}
/****************************************************************
@@ -562,7 +562,7 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupGetInfo_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupGetInfo *r)
{
- return NetLocalGroupGetInfo_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupGetInfo);
}
/****************************************************************
@@ -745,7 +745,7 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupSetInfo_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupSetInfo *r)
{
- return NetLocalGroupSetInfo_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupSetInfo);
}
/****************************************************************
@@ -945,7 +945,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupEnum_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupEnum *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupEnum);
}
/****************************************************************
@@ -1315,7 +1315,7 @@ WERROR NetLocalGroupAddMembers_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupAddMembers_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupAddMembers *r)
{
- return NetLocalGroupAddMembers_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupAddMembers);
}
/****************************************************************
@@ -1333,7 +1333,7 @@ WERROR NetLocalGroupDelMembers_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupDelMembers_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupDelMembers *r)
{
- return NetLocalGroupDelMembers_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupDelMembers);
}
/****************************************************************
@@ -1351,7 +1351,7 @@ WERROR NetLocalGroupGetMembers_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupGetMembers_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupGetMembers *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupGetMembers);
}
/****************************************************************
@@ -1369,6 +1369,6 @@ WERROR NetLocalGroupSetMembers_r(struct libnetapi_ctx *ctx,
WERROR NetLocalGroupSetMembers_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupSetMembers *r)
{
- return NetLocalGroupSetMembers_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetLocalGroupSetMembers);
}
diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h
index ef6e7cf2b7..5c60e994b1 100644
--- a/source3/lib/netapi/netapi_private.h
+++ b/source3/lib/netapi/netapi_private.h
@@ -20,6 +20,13 @@
#ifndef __LIB_NETAPI_PRIVATE_H__
#define __LIB_NETAPI_PRIVATE_H__
+#define LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, fn) \
+ DEBUG(10,("redirecting call %s to localhost\n", #fn)); \
+ if (!r->in.server_name) { \
+ r->in.server_name = "localhost"; \
+ } \
+ return fn ## _r(ctx, r);
+
struct libnetapi_private_ctx {
struct {
const char *domain_name;
diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c
index 622b8d425d..bd063332bf 100644
--- a/source3/lib/netapi/serverinfo.c
+++ b/source3/lib/netapi/serverinfo.c
@@ -252,6 +252,6 @@ WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
WERROR NetRemoteTOD_l(struct libnetapi_ctx *ctx,
struct NetRemoteTOD *r)
{
- return NetRemoteTOD_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetRemoteTOD);
}
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index ff807997ae..c02dfb9dc9 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -361,12 +361,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
WERROR NetUserAdd_l(struct libnetapi_ctx *ctx,
struct NetUserAdd *r)
{
- /* for now just talk to local RPC server */
- if (!r->in.server_name) {
- r->in.server_name = "localhost";
- }
-
- return NetUserAdd_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserAdd);
}
/****************************************************************
@@ -488,12 +483,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
WERROR NetUserDel_l(struct libnetapi_ctx *ctx,
struct NetUserDel *r)
{
- /* for now just talk to local RPC server */
- if (!r->in.server_name) {
- r->in.server_name = "localhost";
- }
-
- return NetUserDel_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserDel);
}
/****************************************************************
@@ -859,7 +849,7 @@ WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
WERROR NetUserEnum_l(struct libnetapi_ctx *ctx,
struct NetUserEnum *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserEnum);
}
/****************************************************************
@@ -1123,7 +1113,7 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
WERROR NetQueryDisplayInformation_l(struct libnetapi_ctx *ctx,
struct NetQueryDisplayInformation *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetQueryDisplayInformation);
}
/****************************************************************
@@ -1265,7 +1255,7 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetUserGetInfo_l(struct libnetapi_ctx *ctx,
struct NetUserGetInfo *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserGetInfo);
}
/****************************************************************
@@ -1405,7 +1395,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetUserSetInfo_l(struct libnetapi_ctx *ctx,
struct NetUserSetInfo *r)
{
- return WERR_NOT_SUPPORTED;
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserSetInfo);
}
/****************************************************************
@@ -1793,7 +1783,7 @@ WERROR NetUserModalsGet_r(struct libnetapi_ctx *ctx,
WERROR NetUserModalsGet_l(struct libnetapi_ctx *ctx,
struct NetUserModalsGet *r)
{
- return NetUserModalsGet_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserModalsGet);
}
/****************************************************************
@@ -2275,5 +2265,5 @@ WERROR NetUserModalsSet_r(struct libnetapi_ctx *ctx,
WERROR NetUserModalsSet_l(struct libnetapi_ctx *ctx,
struct NetUserModalsSet *r)
{
- return NetUserModalsSet_r(ctx, r);
+ LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetUserModalsSet);
}