summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-24 04:19:08 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-24 04:19:08 +0200
commit2cabbb2eeb7d62f8df1c4d20d90adbd53828dd8a (patch)
treee24ed30156017d899d106344be4e8fc8fcd59b10 /source3
parent9d679c9a67f6dcb1ed1597476c63c8adf3b3f426 (diff)
parent0058176ae32eff7acb07c013d48cca294bd4bf82 (diff)
downloadsamba-2cabbb2eeb7d62f8df1c4d20d90adbd53828dd8a.tar.gz
samba-2cabbb2eeb7d62f8df1c4d20d90adbd53828dd8a.tar.bz2
samba-2cabbb2eeb7d62f8df1c4d20d90adbd53828dd8a.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3')
-rw-r--r--source3/include/includes.h1
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/include/rpc_svcctl.h23
-rw-r--r--source3/include/services.h48
-rw-r--r--source3/lib/interface.c2
-rw-r--r--source3/lib/netapi/tests/netgroup.c223
-rw-r--r--source3/lib/netapi/tests/netuser.c4
-rw-r--r--source3/librpc/gen_ndr/krb5pac.h2
-rw-r--r--source3/librpc/gen_ndr/ndr_krb5pac.c5
-rw-r--r--source3/rpc_server/srv_samr_nt.c63
-rw-r--r--source3/winbindd/winbindd_cm.c2
11 files changed, 280 insertions, 95 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 035d46fe0a..24e33c1720 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -659,6 +659,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
#include "async_req.h"
#include "async_smb.h"
#include "async_sock.h"
+#include "services.h"
#include "lib/smbconf/smbconf.h"
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 7a5cd3b07e..83cd740a78 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1507,7 +1507,7 @@ char *print_sockaddr(char *dest,
const struct sockaddr_storage *psa);
char *print_canonical_sockaddr(TALLOC_CTX *ctx,
const struct sockaddr_storage *pss);
-void set_sockaddr_port(struct sockaddr_storage *psa, uint16 port);
+void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
const char *client_name(int fd);
const char *client_addr(int fd, char *addr, size_t addrlen);
const char *client_socket_addr(int fd, char *addr, size_t addr_len);
diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h
index 0e31a53e32..27858405e7 100644
--- a/source3/include/rpc_svcctl.h
+++ b/source3/include/rpc_svcctl.h
@@ -117,9 +117,6 @@
#define SVC_STATUS_PROCESS_INFO 0x00000000
-/* where we assume the location of the service control scripts */
-#define SVCCTL_SCRIPT_DIR "svcctl"
-
/* utility structures for RPCs */
/*
@@ -159,26 +156,6 @@ typedef struct {
SC_ACTION *actions;
} SERVICE_FAILURE_ACTIONS;
-/*
- * dispatch table of functions to handle the =ServiceControl API
- */
-
-typedef struct {
- /* functions for enumerating subkeys and values */
- WERROR (*stop_service)( const char *service, SERVICE_STATUS *status );
- WERROR (*start_service) ( const char *service );
- WERROR (*service_status)( const char *service, SERVICE_STATUS *status );
-} SERVICE_CONTROL_OPS;
-
-/* structure to store the service handle information */
-
-typedef struct _ServiceInfo {
- uint8 type;
- char *name;
- uint32 access_granted;
- SERVICE_CONTROL_OPS *ops;
-} SERVICE_INFO;
-
/* rpc structures */
diff --git a/source3/include/services.h b/source3/include/services.h
new file mode 100644
index 0000000000..8c2a0ccfba
--- /dev/null
+++ b/source3/include/services.h
@@ -0,0 +1,48 @@
+/*
+ Unix SMB/CIFS implementation.
+ SMB parameters and setup
+ Copyright (C) Andrew Tridgell 1992-1997,
+ Copyright (C) Gerald (Jerry) Carter 2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SERVICES_H /* _SERVICES_H */
+#define _SERVICES_H
+
+/* where we assume the location of the service control scripts */
+#define SVCCTL_SCRIPT_DIR "svcctl"
+
+/*
+ * dispatch table of functions to handle the =ServiceControl API
+ */
+
+typedef struct {
+ /* functions for enumerating subkeys and values */
+ WERROR (*stop_service)( const char *service, SERVICE_STATUS *status );
+ WERROR (*start_service) ( const char *service );
+ WERROR (*service_status)( const char *service, SERVICE_STATUS *status );
+} SERVICE_CONTROL_OPS;
+
+/* structure to store the service handle information */
+
+typedef struct _ServiceInfo {
+ uint8 type;
+ char *name;
+ uint32 access_granted;
+ SERVICE_CONTROL_OPS *ops;
+} SERVICE_INFO;
+
+#endif /* _SERICES_H */
+
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 4536990d28..f533ec92c7 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -289,7 +289,7 @@ const struct sockaddr_storage *iface_ip(const struct sockaddr *ip)
bool iface_local(const struct sockaddr *ip)
{
- return iface_find(ip, True) ? true : false;
+ return iface_find(ip, true) ? true : false;
}
/****************************************************************************
diff --git a/source3/lib/netapi/tests/netgroup.c b/source3/lib/netapi/tests/netgroup.c
index 51a21b3bf5..e43520ad1a 100644
--- a/source3/lib/netapi/tests/netgroup.c
+++ b/source3/lib/netapi/tests/netgroup.c
@@ -127,6 +127,152 @@ static NET_API_STATUS test_netgroupenum(const char *hostname,
return 0;
}
+static NET_API_STATUS test_netgroupgetusers(const char *hostname,
+ uint32_t level,
+ const char *groupname,
+ const char *username)
+{
+ NET_API_STATUS status;
+ uint32_t entries_read = 0;
+ uint32_t total_entries = 0;
+ uint32_t resume_handle = 0;
+ int found_user = 0;
+ const char *current_name = NULL;
+ uint8_t *buffer = NULL;
+ int i;
+
+ struct GROUP_USERS_INFO_0 *info0 = NULL;
+ struct GROUP_USERS_INFO_1 *info1 = NULL;
+
+ printf("testing NetGroupGetUsers level %d\n", level);
+
+ do {
+ status = NetGroupGetUsers(hostname,
+ groupname,
+ level,
+ &buffer,
+ (uint32_t)-1,
+ &entries_read,
+ &total_entries,
+ &resume_handle);
+ if (status == 0 || status == ERROR_MORE_DATA) {
+
+ switch (level) {
+ case 0:
+ info0 = (struct GROUP_USERS_INFO_0 *)buffer;
+ break;
+ case 1:
+ info1 = (struct GROUP_USERS_INFO_1 *)buffer;
+ break;
+ default:
+ break;
+ }
+ for (i=0; i<entries_read; i++) {
+ switch (level) {
+ case 0:
+ current_name = info0->grui0_name;
+ break;
+ case 1:
+ current_name = info1->grui1_name;
+ break;
+ default:
+ break;
+ }
+
+ if (username && strcasecmp(current_name, username) == 0) {
+ found_user = 1;
+ }
+
+ switch (level) {
+ case 0:
+ info0++;
+ break;
+ case 1:
+ info1++;
+ break;
+ }
+ }
+ NetApiBufferFree(buffer);
+ }
+ } while (status == ERROR_MORE_DATA);
+
+ if (status) {
+ return status;
+ }
+
+ if (username && !found_user) {
+ printf("failed to get user\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static NET_API_STATUS test_netgroupsetusers(const char *hostname,
+ const char *groupname,
+ uint32_t level,
+ size_t num_entries,
+ const char **names)
+{
+ NET_API_STATUS status;
+ uint8_t *buffer = NULL;
+ int i = 0;
+ size_t buf_size = 0;
+
+ struct GROUP_USERS_INFO_0 *g0 = NULL;
+ struct GROUP_USERS_INFO_1 *g1 = NULL;
+
+ printf("testing NetGroupSetUsers level %d\n", level);
+
+ switch (level) {
+ case 0:
+ buf_size = sizeof(struct GROUP_USERS_INFO_0) * num_entries;
+
+ status = NetApiBufferAllocate(buf_size, (void **)&g0);
+ if (status) {
+ goto out;
+ }
+
+ for (i=0; i<num_entries; i++) {
+ g0[i].grui0_name = names[i];
+ }
+
+ buffer = (uint8_t *)g0;
+ break;
+ case 1:
+ buf_size = sizeof(struct GROUP_USERS_INFO_1) * num_entries;
+
+ status = NetApiBufferAllocate(buf_size, (void **)&g1);
+ if (status) {
+ goto out;
+ }
+
+ for (i=0; i<num_entries; i++) {
+ g1[i].grui1_name = names[i];
+ }
+
+ buffer = (uint8_t *)g1;
+ break;
+ default:
+ break;
+ }
+
+ /* NetGroupSetUsers */
+
+ status = NetGroupSetUsers(hostname,
+ groupname,
+ level,
+ buffer,
+ num_entries);
+ if (status) {
+ goto out;
+ }
+
+ out:
+ NetApiBufferFree(buffer);
+ return status;
+}
+
NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
const char *hostname)
{
@@ -137,6 +283,7 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
uint32_t parm_err = 0;
uint32_t levels[] = { 0, 1, 2, 3};
uint32_t enum_levels[] = { 0, 1, 2, 3};
+ uint32_t getmem_levels[] = { 0, 1};
int i;
printf("NetGroup tests\n");
@@ -201,9 +348,16 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
printf("testing NetGroupSetInfo level 0\n");
status = NetGroupSetInfo(hostname, groupname, 0, (uint8_t *)&g0, &parm_err);
- if (status) {
- NETAPI_STATUS(ctx, status, "NetGroupSetInfo");
- goto out;
+ switch (status) {
+ case 0:
+ break;
+ case 50: /* not supported */
+ case 124: /* not implemented */
+ groupname2 = groupname;
+ goto skip_rename;
+ default:
+ NETAPI_STATUS(ctx, status, "NetGroupSetInfo");
+ goto out;
}
/* should not exist anymore */
@@ -214,6 +368,7 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
goto out;
}
+ skip_rename:
/* query info */
for (i=0; i<ARRAY_SIZE(levels); i++) {
@@ -233,6 +388,17 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
goto out;
}
+ /* should not be member */
+
+ for (i=0; i<ARRAY_SIZE(getmem_levels); i++) {
+
+ status = test_netgroupgetusers(hostname, getmem_levels[i], groupname2, NULL);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupGetUsers");
+ goto out;
+ }
+ }
+
printf("testing NetGroupAddUser\n");
status = NetGroupAddUser(hostname, groupname2, username);
@@ -241,6 +407,17 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
goto out;
}
+ /* should be member */
+
+ for (i=0; i<ARRAY_SIZE(getmem_levels); i++) {
+
+ status = test_netgroupgetusers(hostname, getmem_levels[i], groupname2, username);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupGetUsers");
+ goto out;
+ }
+ }
+
printf("testing NetGroupDelUser\n");
status = NetGroupDelUser(hostname, groupname2, username);
@@ -249,6 +426,46 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
goto out;
}
+ /* should not be member */
+
+ status = test_netgroupgetusers(hostname, 0, groupname2, NULL);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupGetUsers");
+ goto out;
+ }
+
+ /* set it again via exlicit member set */
+
+ status = test_netgroupsetusers(hostname, groupname2, 0, 1, &username);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupSetUsers");
+ goto out;
+ }
+
+ /* should be member */
+
+ status = test_netgroupgetusers(hostname, 0, groupname2, username);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupGetUsers");
+ goto out;
+ }
+#if 0
+ /* wipe out member list */
+
+ status = test_netgroupsetusers(hostname, groupname2, 0, 0, NULL);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupSetUsers");
+ goto out;
+ }
+
+ /* should not be member */
+
+ status = test_netgroupgetusers(hostname, 0, groupname2, NULL);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetGroupGetUsers");
+ goto out;
+ }
+#endif
status = NetUserDel(hostname, username);
if (status) {
NETAPI_STATUS(ctx, status, "NetUserDel");
diff --git a/source3/lib/netapi/tests/netuser.c b/source3/lib/netapi/tests/netuser.c
index 7bbc5ca347..41f794bf34 100644
--- a/source3/lib/netapi/tests/netuser.c
+++ b/source3/lib/netapi/tests/netuser.c
@@ -449,6 +449,10 @@ NET_API_STATUS netapitest_user(struct libnetapi_ctx *ctx,
printf("NetUser tests succeeded\n");
out:
+ /* cleanup */
+ NetUserDel(hostname, username);
+ NetUserDel(hostname, username2);
+
if (status != 0) {
printf("NetUser testsuite failed with: %s\n",
libnetapi_get_error_string(ctx, status));
diff --git a/source3/librpc/gen_ndr/krb5pac.h b/source3/librpc/gen_ndr/krb5pac.h
index 7ec3e95d70..73bd0d95bb 100644
--- a/source3/librpc/gen_ndr/krb5pac.h
+++ b/source3/librpc/gen_ndr/krb5pac.h
@@ -24,7 +24,7 @@ struct PAC_LOGON_INFO {
struct netr_SamInfo3 info3;
struct dom_sid2 *res_group_dom_sid;/* [unique] */
struct samr_RidWithAttributeArray res_groups;
-}/* [gensize] */;
+};
struct PAC_UNKNOWN_12 {
uint16_t upn_size;/* [value(2*strlen_m(upn_name))] */
diff --git a/source3/librpc/gen_ndr/ndr_krb5pac.c b/source3/librpc/gen_ndr/ndr_krb5pac.c
index f9e93e5210..125fb7eb77 100644
--- a/source3/librpc/gen_ndr/ndr_krb5pac.c
+++ b/source3/librpc/gen_ndr/ndr_krb5pac.c
@@ -161,11 +161,6 @@ _PUBLIC_ void ndr_print_PAC_LOGON_INFO(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static size_t ndr_size_PAC_LOGON_INFO(const struct PAC_LOGON_INFO *r, int flags)
-{
- return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO);
-}
-
_PUBLIC_ enum ndr_err_code ndr_push_PAC_LOGON_INFO_CTR(struct ndr_push *ndr, int ndr_flags, const struct PAC_LOGON_INFO_CTR *r)
{
if (ndr_flags & NDR_SCALARS) {
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 0f82675d3d..386e081d4a 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1774,66 +1774,6 @@ NTSTATUS _samr_QueryAliasInfo(pipes_struct *p,
return NT_STATUS_OK;
}
-#if 0
-/*******************************************************************
- samr_reply_lookup_ids
- ********************************************************************/
-
- uint32 _samr_lookup_ids(pipes_struct *p, SAMR_Q_LOOKUP_IDS *q_u, SAMR_R_LOOKUP_IDS *r_u)
-{
- uint32 rid[MAX_SAM_ENTRIES];
- int num_rids = q_u->num_sids1;
-
- r_u->status = NT_STATUS_OK;
-
- DEBUG(5,("_samr_lookup_ids: %d\n", __LINE__));
-
- if (num_rids > MAX_SAM_ENTRIES) {
- num_rids = MAX_SAM_ENTRIES;
- DEBUG(5,("_samr_lookup_ids: truncating entries to %d\n", num_rids));
- }
-
-#if 0
- int i;
- SMB_ASSERT_ARRAY(q_u->uni_user_name, num_rids);
-
- for (i = 0; i < num_rids && status == 0; i++)
- {
- struct sam_passwd *sam_pass;
- fstring user_name;
-
-
- fstrcpy(user_name, unistrn2(q_u->uni_user_name[i].buffer,
- q_u->uni_user_name[i].uni_str_len));
-
- /* find the user account */
- become_root();
- sam_pass = get_smb21pwd_entry(user_name, 0);
- unbecome_root();
-
- if (sam_pass == NULL)
- {
- status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
- rid[i] = 0;
- }
- else
- {
- rid[i] = sam_pass->user_rid;
- }
- }
-#endif
-
- num_rids = 1;
- rid[0] = BUILTIN_ALIAS_RID_USERS;
-
- init_samr_r_lookup_ids(&r_u, num_rids, rid, NT_STATUS_OK);
-
- DEBUG(5,("_samr_lookup_ids: %d\n", __LINE__));
-
- return r_u->status;
-}
-#endif
-
/*******************************************************************
_samr_LookupNames
********************************************************************/
@@ -5339,6 +5279,9 @@ NTSTATUS _samr_SetGroupInfo(pipes_struct *p,
case 1:
fstrcpy(map.comment, r->in.info->all.description.string);
break;
+ case 2:
+ /* group rename is not supported yet */
+ return NT_STATUS_NOT_SUPPORTED;
case 4:
fstrcpy(map.comment, r->in.info->description.string);
break;
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 05c39f8f2b..9268542da6 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1064,7 +1064,7 @@ static bool add_sockaddr_to_array(TALLOC_CTX *mem_ctx,
}
(*addrs)[*num] = *pss;
- set_sockaddr_port(&(*addrs)[*num], port);
+ set_sockaddr_port((struct sockaddr *)&(*addrs)[*num], port);
*num += 1;
return True;