From ba1699463bee4d622e76f54c1a1c17858545c84f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 6 Jun 2012 15:22:31 +0200 Subject: s3:smb: introduce a name TID_FIELD_INVALID for the invalid value for a cnum/tid Pair-Programmed-With: Stefan Metzmacher --- source3/include/smb.h | 1 + source3/smbd/connection.c | 2 +- source3/smbd/msdfs.c | 2 +- source3/utils/net_status.c | 4 ++-- source3/utils/status.c | 2 +- source3/web/statuspage.c | 6 +++--- 6 files changed, 9 insertions(+), 8 deletions(-) (limited to 'source3') diff --git a/source3/include/smb.h b/source3/include/smb.h index 5ee2b1fb44..5887ca95e3 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -672,6 +672,7 @@ enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K}; #define UID_FIELD_INVALID 0 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */ +#define TID_FIELD_INVALID -1 #define CNUM_OFFSET 1 /* shift for bitmap index */ /* diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 01eb9d79f7..846a173ad7 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -71,7 +71,7 @@ static int count_fn(struct db_record *rec, { struct count_stat *cs = (struct count_stat *)udp; - if (crec->cnum == -1) { + if (crec->cnum == TID_FIELD_INVALID) { return 0; } diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 9da8a8da75..6f182b4920 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -276,7 +276,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx, } conn->params->service = snum; - conn->cnum = (unsigned)-1; + conn->cnum = TID_FIELD_INVALID; DLIST_ADD(conn->sconn->connections, conn); conn->sconn->num_connections++; diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c index 2bb639138e..85d023505e 100644 --- a/source3/utils/net_status.c +++ b/source3/utils/net_status.c @@ -96,7 +96,7 @@ static int show_share(struct db_record *rec, const struct connections_data *crec, void *state) { - if (crec->cnum == -1) + if (crec->cnum == TID_FIELD_INVALID) return 0; if (!process_exists(crec->pid)) { @@ -143,7 +143,7 @@ static int show_share_parseable(const struct connections_key *key, int i; bool guest = true; - if (crec->cnum == -1) + if (crec->cnum == TID_FIELD_INVALID) return 0; if (!process_exists(crec->pid)) { diff --git a/source3/utils/status.c b/source3/utils/status.c index 1bcb1403fc..a6e8055062 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -250,7 +250,7 @@ static int traverse_fn1(const struct connections_key *key, const struct connections_data *crec, void *state) { - if (crec->cnum == -1) + if (crec->cnum == TID_FIELD_INVALID) return 0; if (!process_exists(crec->pid) || !Ucrit_checkUid(crec->uid)) { diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index 4b3d3aea86..dd83d158ae 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -190,7 +190,7 @@ static int traverse_fn1(const struct connections_key *key, const struct connections_data *crec, void *private_data) { - if (crec->cnum == -1 && process_exists(crec->pid)) { + if (crec->cnum == TID_FIELD_INVALID && process_exists(crec->pid)) { char buf[30]; slprintf(buf,sizeof(buf)-1,"kill_%s", procid_str_static(&crec->pid)); if (cgi_variable(buf)) { @@ -206,7 +206,7 @@ static int traverse_fn2(const struct connections_key *key, const struct connections_data *crec, void *private_data) { - if (crec->cnum == -1 || !process_exists(crec->pid) || + if (crec->cnum == TID_FIELD_INVALID || !process_exists(crec->pid) || procid_equal(&crec->pid, &smbd_pid)) return 0; @@ -230,7 +230,7 @@ static int traverse_fn3(const struct connections_key *key, const struct connections_data *crec, void *private_data) { - if (crec->cnum == -1 || !process_exists(crec->pid)) + if (crec->cnum == TID_FIELD_INVALID || !process_exists(crec->pid)) return 0; printf("%s%s%s%s%s%s\n", -- cgit