[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Jan 8 06:04:04 UTC 2019
The branch, master has been updated
via f23287bcb69 waf: fix tri-state of --with-sendfile-support being auto the default
via 99c030bce6e waf: fix waf errors with sendfail detection on Solaris
via a2402f97144 s3: net: Do not set NET_FLAGS_ANONYMOUS with -k
via b06f0912fc6 libnet4: Use dom_sid_str_buf
via f1e71a2c1e0 winbind4: Use dom_sid_str_buf
via 6f4b2cc9659 pysecurity: Use dom_sid_str_buf
via 186fff5fc35 auth4: Use dom_sid_str_buf
via 62bc70d18c3 ntpd: Use dom_sid_str_buf
via 542da7e8002 passdb: Use dom_sid_str_buf
via a74946e3007 winbind: Fix a typo
via 0d208f42cc6 pydsdb: Use dom_sid_str_buf
via c9036f2597b libndr: Use dom_sid_str_buf
via 08be989aa91 smbclient: Use dom_sid_str_buf
via 6b8c77152e9 libcli: Simplify smblsa_lookup_name
via af95db60dec winbindd: Use dom_sid_str_buf
via 12ffef9fc2d auth3: Use dom_sid_str_buf
via cc0664dd045 lib: Remove StrnCpy
via 2cc2a753059 smbd: Use strlcpy instead of StrnCpy
via e74ad1b7451 nmbd: Use strlcpy instead of StrnCpy
via fa945bc1e09 libsmb: Use strlcpy instead of StrnCpy
via facd6f2daf6 s4:torture:base:bench-readwrite: fix uninitialized memory causing segfault
from 24cfa0baf51 netcmd: Small refactor to SMB connection in domain backup
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f23287bcb69d7c1318aad2472487066e6e6751f4
Author: Björn Jacke <bjacke at samba.org>
Date: Mon Jan 7 01:05:19 2019 +0100
waf: fix tri-state of --with-sendfile-support being auto the default
--with-sendfile-support should be used automatically if it's found.
Configure now also fails reliably for all platforms when sendfile was
explicitly requested but failed to be detected.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9707
Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Jan 8 07:03:49 CET 2019 on sn-devel-144
commit 99c030bce6e246dfa1821a79abe751013b4bd2ef
Author: Björn Jacke <bjacke at samba.org>
Date: Mon Jan 7 00:28:34 2019 +0100
waf: fix waf errors with sendfail detection on Solaris
Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a2402f9714449f9dcb86f40dc178a5b5d8384469
Author: Justin Stephenson <jstephen at redhat.com>
Date: Mon Dec 17 11:26:11 2018 -0500
s3: net: Do not set NET_FLAGS_ANONYMOUS with -k
This affects net rpc getsid and net rpc changetrustpw commands.
This avoids an anonymous IPC connection being made when -k is used,
this only affects net rpc getsid and net rpc changetrustpw commands.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13726
Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Noel Power <npower at samba.org>
commit b06f0912fc6873d3f7ca49d57267005c0f5c6c19
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 16 17:24:36 2018 +0100
libnet4: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f1e71a2c1e012596a0a753ea5f11df06244a3cb1
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 16 17:17:58 2018 +0100
winbind4: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6f4b2cc9659ff9da7f1e6c60678a0d4d4f453611
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 16 17:12:19 2018 +0100
pysecurity: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 186fff5fc3537eedf03a26f1419f2d4844648662
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 16 17:11:55 2018 +0100
auth4: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 62bc70d18c395101876bcad519982ed6ef473aac
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 16 17:02:54 2018 +0100
ntpd: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 542da7e8002133ab5ef16befa04bc7d9f4e68b9d
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 16 16:59:32 2018 +0100
passdb: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a74946e3007259e42d296fc1209860d7aee90281
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 20:30:10 2018 +0100
winbind: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0d208f42cc695570cc6403554f231a6b9a051623
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 21 09:34:34 2018 +0100
pydsdb: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c9036f2597b90103df9469ffed637ed132c39846
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 21 09:32:41 2018 +0100
libndr: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 08be989aa91682956133270a6ee41bd1ae1622d1
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 21 09:30:58 2018 +0100
smbclient: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6b8c77152e901de97c182285a698a67fad7bb7b3
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 21 09:27:43 2018 +0100
libcli: Simplify smblsa_lookup_name
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit af95db60dec913fb509194e8c8f70d81c2e4e859
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 20 21:57:21 2018 +0100
winbindd: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 12ffef9fc2d6deba8e39e7097ab0e94750f8e7b3
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 20 21:53:17 2018 +0100
auth3: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit cc0664dd0453c85147b4b270bddb418bb1d4d0a9
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 31 07:16:29 2018 +0100
lib: Remove StrnCpy
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2cc2a75305955cf0974c7de801ec440a8e45e3fb
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 31 07:15:21 2018 +0100
smbd: Use strlcpy instead of StrnCpy
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e74ad1b74514b23e11ebc46c1234f5421eda798f
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 31 07:15:03 2018 +0100
nmbd: Use strlcpy instead of StrnCpy
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit fa945bc1e09829d8ef8a4454d420cbd07ca47002
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 31 07:14:48 2018 +0100
libsmb: Use strlcpy instead of StrnCpy
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit facd6f2daf6df0f9c82bcbe36946507736e9648c
Author: Aliaksei Karaliou <akaraliou at panasas.com>
Date: Fri Dec 21 16:47:00 2018 +0300
s4:torture:base:bench-readwrite: fix uninitialized memory causing segfault
Allocation of 'struct smb_composite_connect' happens without zeroing
so that smb_composite_connect_send() thinks that connection
already exists and fails on its handling.
Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Douglas Bagnall <dbagnall at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
librpc/ndr/ndr_sec_helper.c | 3 +-
source3/auth/token_util.c | 10 ++--
source3/client/client.c | 7 +--
source3/include/proto.h | 1 -
source3/lib/util_str.c | 26 ----------
source3/libsmb/namequery.c | 2 +-
source3/nmbd/nmbd_incomingdgrams.c | 2 +-
source3/passdb/pdb_samba_dsdb.c | 97 ++++++++++++++++++++++++-------------
source3/smbd/lanman.c | 2 +-
source3/utils/net_rpc.c | 10 +++-
source3/winbindd/idmap_autorid.c | 2 +-
source3/winbindd/winbindd_cm.c | 18 ++++---
source3/wscript | 19 +++-----
source4/auth/sam.c | 16 +++---
source4/auth/session.c | 15 ++----
source4/auth/unix_token.c | 18 +++----
source4/dsdb/pydsdb.c | 10 +---
source4/libcli/util/clilsa.c | 11 ++---
source4/libnet/libnet_join.c | 11 +++--
source4/libnet/libnet_samdump.c | 4 +-
source4/libnet/libnet_samsync_ldb.c | 27 +++++------
source4/librpc/ndr/py_security.c | 11 ++---
source4/ntp_signd/ntp_signd.c | 15 +++---
source4/torture/basic/misc.c | 4 +-
source4/winbind/idmap.c | 30 ++++++------
25 files changed, 187 insertions(+), 184 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c
index ecc05115d4b..5a2ed16e33e 100644
--- a/librpc/ndr/ndr_sec_helper.c
+++ b/librpc/ndr/ndr_sec_helper.c
@@ -147,7 +147,8 @@ size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
*/
void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
{
- ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr, sid));
+ struct dom_sid_buf buf;
+ ndr->print(ndr, "%-25s: %s", name, dom_sid_str_buf(sid, &buf));
}
void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c
index bfc2c3029b2..f7ebd23e4aa 100644
--- a/source3/auth/token_util.c
+++ b/source3/auth/token_util.c
@@ -1212,15 +1212,18 @@ bool user_sid_in_group_sid(const struct dom_sid *sid, const struct dom_sid *grou
bool result = false;
enum lsa_SidType type;
TALLOC_CTX *mem_ctx = talloc_stackframe();
+ struct dom_sid_buf buf;
if (!lookup_sid(mem_ctx, sid,
NULL, NULL, &type)) {
- DEBUG(1, ("lookup_sid for %s failed\n", dom_sid_string(mem_ctx, sid)));
+ DEBUG(1, ("lookup_sid for %s failed\n",
+ dom_sid_str_buf(sid, &buf)));
goto done;
}
if (type != SID_NAME_USER) {
- DEBUG(5, ("%s is a %s, not a user\n", dom_sid_string(mem_ctx, sid),
+ DEBUG(5, ("%s is a %s, not a user\n",
+ dom_sid_str_buf(sid, &buf),
sid_type_lookup(type)));
goto done;
}
@@ -1230,7 +1233,8 @@ bool user_sid_in_group_sid(const struct dom_sid *sid, const struct dom_sid *grou
&token);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(10, ("could not create token for %s\n", dom_sid_string(mem_ctx, sid)));
+ DEBUG(10, ("could not create token for %s\n",
+ dom_sid_str_buf(sid, &buf)));
goto done;
}
diff --git a/source3/client/client.c b/source3/client/client.c
index e8faed55dc4..3a31463cdbb 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3359,9 +3359,10 @@ static int cmd_posix_whoami(void)
}
d_printf("NUM_SIDS:%" PRIu32 "\n", num_sids);
for (i = 0; i < num_sids; i++) {
- char *sid_str = dom_sid_string(ctx, &sids[i]);
- d_printf("SIDS[%" PRIu32 "]:%s\n", i, sid_str);
- TALLOC_FREE(sid_str);
+ struct dom_sid_buf buf;
+ d_printf("SIDS[%" PRIu32 "]:%s\n",
+ i,
+ dom_sid_str_buf(&sids[i], &buf));
}
return 0;
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index d2f9986c244..c92d9921d6e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -574,7 +574,6 @@ size_t str_charnum(const char *s);
bool trim_char(char *s,char cfront,char cback);
bool strhasupper(const char *s);
bool strhaslower(const char *s);
-char *StrnCpy(char *dest,const char *src,size_t n);
bool in_list(const char *s, const char *list, bool casesensitive);
void fstring_sub(char *s,const char *pattern,const char *insert);
char *realloc_string_sub2(char *string,
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index eb36478d8a2..8568af46c17 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -170,32 +170,6 @@ bool trim_char(char *s,char cfront,char cback)
return ret;
}
-/**
- Like strncpy but always null terminates. Make sure there is room!
- The variable n should always be one less than the available size.
-**/
-char *StrnCpy(char *dest,const char *src,size_t n)
-{
- char *d = dest;
-
- if (!dest) {
- smb_panic("ERROR: NULL dest in StrnCpy");
- }
-
- if (!src) {
- *dest = 0;
- return(dest);
- }
-
- while (n-- && (*d = *src)) {
- d++;
- src++;
- }
-
- *d = 0;
- return(dest);
-}
-
/**
Check if a string is part of a list.
**/
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 6564f4869ea..abeed972403 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -274,7 +274,7 @@ static struct node_status *parse_node_status(TALLOC_CTX *mem_ctx, char *p,
p++;
for (i=0;i< *num_names;i++) {
- StrnCpy(ret[i].name,p,15);
+ strlcpy(ret[i].name,p,16);
trim_char(ret[i].name,'\0',' ');
ret[i].type = CVAL(p,15);
ret[i].flags = p[16];
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index 6fedcfd0255..e8980055b19 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -607,7 +607,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
if(!(servrec->serv.type & SV_TYPE_BACKUP_BROWSER))
continue;
- StrnCpy(p, servrec->serv.name, 15);
+ strlcpy(p, servrec->serv.name, 16);
strupper_m(p);
count++;
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
index 951ab81c22c..0753d38b5f6 100644
--- a/source3/passdb/pdb_samba_dsdb.c
+++ b/source3/passdb/pdb_samba_dsdb.c
@@ -155,7 +155,8 @@ static struct ldb_message *pdb_samba_dsdb_get_samu_private(
struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
m->private_data, struct pdb_samba_dsdb_state);
struct ldb_message *msg;
- char *sidstr, *filter;
+ struct dom_sid_buf sidstr;
+ char *filter;
NTSTATUS status;
msg = (struct ldb_message *)
@@ -165,14 +166,10 @@ static struct ldb_message *pdb_samba_dsdb_get_samu_private(
return talloc_get_type_abort(msg, struct ldb_message);
}
- sidstr = dom_sid_string(talloc_tos(), pdb_get_user_sid(sam));
- if (sidstr == NULL) {
- return NULL;
- }
-
filter = talloc_asprintf(
- talloc_tos(), "(&(objectsid=%s)(objectclass=user))", sidstr);
- TALLOC_FREE(sidstr);
+ talloc_tos(),
+ "(&(objectsid=%s)(objectclass=user))",
+ dom_sid_str_buf(pdb_get_user_sid(sam), &sidstr));
if (filter == NULL) {
return NULL;
}
@@ -725,15 +722,11 @@ static NTSTATUS pdb_samba_dsdb_getsampwsid(struct pdb_methods *m,
NTSTATUS status;
struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
m->private_data, struct pdb_samba_dsdb_state);
- char *sidstr;
-
- sidstr = dom_sid_string(talloc_tos(), sid);
- NT_STATUS_HAVE_NO_MEMORY(sidstr);
+ struct dom_sid_buf buf;
status = pdb_samba_dsdb_getsampwfilter(m, state, sam_acct,
"(&(objectsid=%s)(objectclass=user))",
- sidstr);
- talloc_free(sidstr);
+ dom_sid_str_buf(sid, &buf));
return status;
}
@@ -771,10 +764,15 @@ static NTSTATUS pdb_samba_dsdb_delete_user(struct pdb_methods *m,
m->private_data, struct pdb_samba_dsdb_state);
struct ldb_dn *dn;
int rc;
+ struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- dn = ldb_dn_new_fmt(tmp_ctx, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, pdb_get_user_sid(sam)));
+ dn = ldb_dn_new_fmt(
+ tmp_ctx,
+ state->ldb,
+ "<SID=%s>",
+ dom_sid_str_buf(pdb_get_user_sid(sam), &buf));
if (!dn || !ldb_dn_validate(dn)) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
@@ -1110,6 +1108,7 @@ static NTSTATUS pdb_samba_dsdb_delete_dom_group(struct pdb_methods *m,
struct ldb_message *msg;
struct ldb_dn *dn;
int rc;
+ struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
@@ -1120,7 +1119,11 @@ static NTSTATUS pdb_samba_dsdb_delete_dom_group(struct pdb_methods *m,
return NT_STATUS_INTERNAL_ERROR;
}
- dn = ldb_dn_new_fmt(tmp_ctx, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, &sid));
+ dn = ldb_dn_new_fmt(
+ tmp_ctx,
+ state->ldb,
+ "<SID=%s>",
+ dom_sid_str_buf(&sid, &buf));
if (!dn || !ldb_dn_validate(dn)) {
talloc_free(tmp_ctx);
ldb_transaction_cancel(state->ldb);
@@ -1193,11 +1196,16 @@ static NTSTATUS pdb_samba_dsdb_enum_group_members(struct pdb_methods *m,
uint32_t *members;
struct ldb_dn *dn;
NTSTATUS status;
+ struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- dn = ldb_dn_new_fmt(tmp_ctx, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, group));
+ dn = ldb_dn_new_fmt(
+ tmp_ctx,
+ state->ldb,
+ "<SID=%s>",
+ dom_sid_str_buf(group, &buf));
if (!dn || !ldb_dn_validate(dn)) {
return NT_STATUS_NO_MEMORY;
}
@@ -1285,10 +1293,11 @@ static NTSTATUS fake_enum_group_memberships(struct pdb_samba_dsdb_state *state,
if (id_map.xid.type == ID_TYPE_GID || id_map.xid.type == ID_TYPE_BOTH) {
gids[0] = id_map.xid.id;
} else {
+ struct dom_sid_buf buf1, buf2;
DEBUG(1, (__location__
"Group %s, of which %s is a member, could not be converted to a GID\n",
- dom_sid_string(tmp_ctx, &group_sids[0]),
- dom_sid_string(tmp_ctx, &user->user_sid)));
+ dom_sid_str_buf(&group_sids[0], &buf1),
+ dom_sid_str_buf(&user->user_sid, &buf2)));
talloc_free(tmp_ctx);
/* We must error out, otherwise a user might
* avoid a DENY acl based on a group they
@@ -1392,9 +1401,11 @@ static NTSTATUS pdb_samba_dsdb_enum_group_memberships(struct pdb_methods *m,
if (id_map.xid.type == ID_TYPE_GID || id_map.xid.type == ID_TYPE_BOTH) {
gids[num_groups] = id_map.xid.id;
} else {
+ struct dom_sid_buf buf;
DEBUG(1, (__location__
"Group %s, of which %s is a member, could not be converted to a GID\n",
- dom_sid_string(tmp_ctx, &group_sids[num_groups]),
+ dom_sid_str_buf(&group_sids[num_groups],
+ &buf),
ldb_dn_get_linearized(msg->dn)));
talloc_free(tmp_ctx);
/* We must error out, otherwise a user might
@@ -1434,6 +1445,7 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem_by_sid(struct pdb_methods *m,
struct ldb_message *msg;
int ret;
struct ldb_message_element *el;
+ struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
msg = ldb_msg_new(tmp_ctx);
@@ -1442,12 +1454,20 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem_by_sid(struct pdb_methods *m,
return NT_STATUS_NO_MEMORY;
}
- msg->dn = ldb_dn_new_fmt(msg, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, groupsid));
+ msg->dn = ldb_dn_new_fmt(
+ msg,
+ state->ldb,
+ "<SID=%s>",
+ dom_sid_str_buf(groupsid, &buf));
if (!msg->dn || !ldb_dn_validate(msg->dn)) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
- ret = ldb_msg_add_fmt(msg, "member", "<SID=%s>", dom_sid_string(tmp_ctx, membersid));
+ ret = ldb_msg_add_fmt(
+ msg,
+ "member",
+ "<SID=%s>",
+ dom_sid_str_buf(membersid, &buf));
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
@@ -1551,10 +1571,15 @@ static NTSTATUS pdb_samba_dsdb_delete_alias(struct pdb_methods *m,
struct ldb_message *msg;
struct ldb_dn *dn;
int rc;
+ struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- dn = ldb_dn_new_fmt(tmp_ctx, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, sid));
+ dn = ldb_dn_new_fmt(
+ tmp_ctx,
+ state->ldb,
+ "<SID=%s>",
+ dom_sid_str_buf(sid, &buf));
if (!dn || !ldb_dn_validate(dn)) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
@@ -1713,10 +1738,15 @@ static NTSTATUS pdb_samba_dsdb_enum_aliasmem(struct pdb_methods *m,
struct ldb_dn *dn;
unsigned int num_members;
NTSTATUS status;
+ struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- dn = ldb_dn_new_fmt(tmp_ctx, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, alias));
+ dn = ldb_dn_new_fmt(
+ tmp_ctx,
+ state->ldb,
+ "<SID=%s>",
+ dom_sid_str_buf(alias, &buf));
if (!dn || !ldb_dn_validate(dn)) {
return NT_STATUS_NO_MEMORY;
}
@@ -1747,7 +1777,6 @@ static NTSTATUS pdb_samba_dsdb_enum_alias_memberships(struct pdb_methods *m,
unsigned int num_groupSIDs = 0;
char *filter;
NTSTATUS status;
- const char *sid_string;
const char *sid_dn;
DATA_BLOB sid_blob;
@@ -1765,13 +1794,12 @@ static NTSTATUS pdb_samba_dsdb_enum_alias_memberships(struct pdb_methods *m,
}
for (i = 0; i < num_members; i++) {
- sid_string = dom_sid_string(tmp_ctx, &members[i]);
- if (sid_string == NULL) {
- TALLOC_FREE(tmp_ctx);
- return NT_STATUS_NO_MEMORY;
- }
+ struct dom_sid_buf buf;
- sid_dn = talloc_asprintf(tmp_ctx, "<SID=%s>", sid_string);
+ sid_dn = talloc_asprintf(
+ tmp_ctx,
+ "<SID=%s>",
+ dom_sid_str_buf(&members[i], &buf));
if (sid_dn == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
@@ -3136,13 +3164,15 @@ static NTSTATUS pdb_samba_dsdb_get_trusted_domain_by_sid(struct pdb_methods *m,
};
struct ldb_message *msg = NULL;
struct pdb_trusted_domain *d = NULL;
+ struct dom_sid_buf buf;
NTSTATUS status;
status = dsdb_trust_search_tdo_by_sid(state->ldb, sid,
attrs, tmp_ctx, &msg);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("dsdb_trust_search_tdo_by_sid(%s) - %s ",
- dom_sid_string(tmp_ctx, sid), nt_errstr(status));
+ dom_sid_str_buf(sid, &buf),
+ nt_errstr(status));
TALLOC_FREE(tmp_ctx);
return status;
}
@@ -3150,7 +3180,8 @@ static NTSTATUS pdb_samba_dsdb_get_trusted_domain_by_sid(struct pdb_methods *m,
status = pdb_samba_dsdb_msg_to_trusted_domain(msg, mem_ctx, &d);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("pdb_samba_dsdb_msg_to_trusted_domain(%s) - %s ",
- dom_sid_string(tmp_ctx, sid), nt_errstr(status));
+ dom_sid_str_buf(sid, &buf),
+ nt_errstr(status));
TALLOC_FREE(tmp_ctx);
return status;
}
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index dcc7f916d6e..9637194f697 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -364,7 +364,7 @@ static int package(struct pack_desc *p, ...)
{
char *s = va_arg(args,char*);
if (p->buflen >= needed) {
- StrnCpy(p->structbuf,s?s:"",needed-1);
+ strlcpy(p->structbuf,s?s:"",needed);
}
}
break;
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 6d5a1043792..c300b8a4b3d 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -316,6 +316,12 @@ static NTSTATUS rpc_changetrustpw_internals(struct net_context *c,
int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv)
{
+ int conn_flags = NET_FLAGS_PDC;
+
+ if (!c->opt_user_specified && !c->opt_kerberos) {
+ conn_flags |= NET_FLAGS_ANONYMOUS;
+ }
+
if (c->display_usage) {
d_printf( "%s\n"
"net rpc changetrustpw\n"
@@ -326,7 +332,7 @@ int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv)
}
return run_rpc_command(c, NULL, &ndr_table_netlogon,
- NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
+ conn_flags,
rpc_changetrustpw_internals,
argc, argv);
}
@@ -863,7 +869,7 @@ int net_rpc_getsid(struct net_context *c, int argc, const char **argv)
{
int conn_flags = NET_FLAGS_PDC;
- if (!c->opt_user_specified) {
+ if (!c->opt_user_specified && !c->opt_kerberos) {
conn_flags |= NET_FLAGS_ANONYMOUS;
}
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index 6e38a57805b..1d0f0fafb82 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -464,7 +464,7 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc_action(
return ret;
}
- DEBUG(10, ("Sepecial sid %s not mapped. falling back to "
+ DEBUG(10, ("Special sid %s not mapped. falling back to "
"regular allocation\n",
dom_sid_str_buf(ctx->map->sid, &buf)));
}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 2e98c7634e8..22d3dcaa92b 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -2552,15 +2552,15 @@ no_dssetup:
!dom_sid_equal(&domain->sid,
lsa_info->dns.sid))
{
+ struct dom_sid_buf buf1, buf2;
DEBUG(1, ("set_dc_type_and_flags_connect: DC "
"for domain %s (%s) claimed it was "
"a DC for domain %s, refusing to "
"initialize\n",
- dom_sid_string(talloc_tos(),
- &domain->sid),
+ dom_sid_str_buf(&domain->sid, &buf1),
domain->name,
- dom_sid_string(talloc_tos(),
- lsa_info->dns.sid)));
+ dom_sid_str_buf(lsa_info->dns.sid,
+ &buf2)));
TALLOC_FREE(cli);
TALLOC_FREE(mem_ctx);
return;
@@ -2611,16 +2611,18 @@ no_dssetup:
!dom_sid_equal(&domain->sid,
lsa_info->account_domain.sid))
{
+ struct dom_sid_buf buf1, buf2;
DEBUG(1,
("set_dc_type_and_flags_connect: "
"DC for domain %s (%s) claimed "
"it was a DC for domain %s, "
"refusing to initialize\n",
- dom_sid_string(talloc_tos(),
- &domain->sid),
+ dom_sid_str_buf(
+ &domain->sid, &buf1),
domain->name,
- dom_sid_string(talloc_tos(),
- lsa_info->account_domain.sid)));
+ dom_sid_str_buf(
+ lsa_info->account_domain.sid,
+ &buf2)));
TALLOC_FREE(cli);
--
Samba Shared Repository
More information about the samba-cvs
mailing list