[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Tue Mar 6 06:30:05 MST 2012
The branch, master has been updated
via 1f62df5 s3: Move a talloc_strdup out of the main code path
via b709589 s3: Fix some format string warnings
from f033c22 policy/python: Move python binding tests to standard location.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 1f62df52aaafc4f777fed4541625a92f15c8e12c
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 5 16:56:53 2012 +0100
s3: Move a talloc_strdup out of the main code path
This is only used for AS_GUEST requests
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Tue Mar 6 14:29:50 CET 2012 on sn-devel-104
commit b709589445820ae8b30e9554c08ca205c3b946f1
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 3 21:37:13 2012 +0100
s3: Fix some format string warnings
We were printing nmb->header.name_trn_id with %hu, which denotes a
short. However, header.name_trn_id is an int for the better or
worse.
-----------------------------------------------------------------------
Summary of changes:
source3/nmbd/nmbd_packets.c | 22 ++++++++++++--------
source3/smbd/process.c | 46 +++++++++++++++++++++++++++++--------------
2 files changed, 44 insertions(+), 24 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 81e2f7f..f8bfe45 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -963,9 +963,10 @@ void reply_netbios_packet(struct packet_struct *orig_packet,
return;
}
- DEBUG(4,("reply_netbios_packet: sending a reply of packet type: %s %s to ip %s \
-for id %hu\n", packet_type, nmb_namestr(&orig_nmb->question.question_name),
- inet_ntoa(packet.ip), orig_nmb->header.name_trn_id));
+ DEBUG(4, ("reply_netbios_packet: sending a reply of packet type: %s "
+ "%s to ip %s for id %d\n", packet_type,
+ nmb_namestr(&orig_nmb->question.question_name),
+ inet_ntoa(packet.ip), orig_nmb->header.name_trn_id));
nmb->header.name_trn_id = orig_nmb->header.name_trn_id;
nmb->header.opcode = opcode;
@@ -1435,15 +1436,17 @@ static struct subnet_record *find_subnet_for_nmb_packet( struct packet_struct *p
rrec = find_response_record( &subrec, nmb->header.name_trn_id);
if(rrec == NULL) {
- DEBUG(3,("find_subnet_for_nmb_packet: response record not found for response id %hu\n",
- nmb->header.name_trn_id));
+ DEBUG(3, ("find_subnet_for_nmb_packet: response "
+ "record not found for response id %d\n",
+ nmb->header.name_trn_id));
nb_packet_dispatch(packet_server, p);
return NULL;
}
if(subrec == NULL) {
- DEBUG(0,("find_subnet_for_nmb_packet: subnet record not found for response id %hu\n",
- nmb->header.name_trn_id));
+ DEBUG(0, ("find_subnet_for_nmb_packet: subnet record "
+ "not found for response id %d\n",
+ nmb->header.name_trn_id));
return NULL;
}
@@ -1565,8 +1568,9 @@ static void process_nmb_response(struct packet_struct *p)
return;
if(rrec == NULL) {
- DEBUG(0,("process_nmb_response: response packet received but no response record \
-found for id = %hu. Ignoring packet.\n", nmb->header.name_trn_id));
+ DEBUG(0, ("process_nmb_response: response packet received but "
+ "no response record found for id = %d. Ignoring "
+ "packet.\n", nmb->header.name_trn_id));
return;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index f61ad5d..1131318 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1351,7 +1351,6 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req)
uint16 session_tag;
connection_struct *conn = NULL;
struct smbd_server_connection *sconn = req->sconn;
- char *raddr;
errno = 0;
@@ -1466,21 +1465,38 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req)
conn->num_smb_operations++;
}
- raddr = tsocket_address_inet_addr_string(sconn->remote_address,
- talloc_tos());
- if (raddr == NULL) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- return conn;
- }
+ /*
+ * Does this protocol need to be run as guest? (Only archane
+ * messenger service requests have this...)
+ */
+ if (flags & AS_GUEST) {
+ char *raddr;
+ bool ok;
+
+ if (!change_to_guest()) {
+ reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+ return conn;
+ }
+
+ raddr = tsocket_address_inet_addr_string(sconn->remote_address,
+ talloc_tos());
+ if (raddr == NULL) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return conn;
+ }
+
+ /*
+ * Haven't we checked this in smbd_process already???
+ */
+
+ ok = allow_access(lp_hostsdeny(-1), lp_hostsallow(-1),
+ sconn->remote_hostname, raddr);
+ TALLOC_FREE(raddr);
- /* does this protocol need to be run as guest? */
- if ((flags & AS_GUEST)
- && (!change_to_guest() ||
- !allow_access(lp_hostsdeny(-1), lp_hostsallow(-1),
- sconn->remote_hostname,
- raddr))) {
- reply_nterror(req, NT_STATUS_ACCESS_DENIED);
- return conn;
+ if (!ok) {
+ reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+ return conn;
+ }
}
smb_messages[type].fn(req);
--
Samba Shared Repository
More information about the samba-cvs
mailing list