diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-06-04 15:32:28 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-06-05 19:28:35 +0200 |
commit | 8693a4fff95f2fa1f9c3b93429101c3b3d22218f (patch) | |
tree | 79558b09e4d1a3cd3d11164ed3e5729ed5436674 /source3 | |
parent | 5a122931ede833484d9c47d7a9b5434e85b5c8d7 (diff) | |
download | samba-8693a4fff95f2fa1f9c3b93429101c3b3d22218f.tar.gz samba-8693a4fff95f2fa1f9c3b93429101c3b3d22218f.tar.bz2 samba-8693a4fff95f2fa1f9c3b93429101c3b3d22218f.zip |
s3:lib: split things into a conn_tdb.h
metze
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Jun 5 19:28:35 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 19 | ||||
-rw-r--r-- | source3/include/smb.h | 25 | ||||
-rw-r--r-- | source3/lib/conn_tdb.c | 1 | ||||
-rw-r--r-- | source3/lib/conn_tdb.h | 62 | ||||
-rw-r--r-- | source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 1 | ||||
-rw-r--r-- | source3/smbd/connection.c | 1 | ||||
-rw-r--r-- | source3/smbd/server.c | 1 | ||||
-rw-r--r-- | source3/smbd/sesssetup.c | 1 | ||||
-rw-r--r-- | source3/utils/net_serverid.c | 1 | ||||
-rw-r--r-- | source3/utils/net_status.c | 1 | ||||
-rw-r--r-- | source3/utils/status.c | 1 | ||||
-rw-r--r-- | source3/web/statuspage.c | 1 |
12 files changed, 71 insertions, 44 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index b8a2409ab5..b5a66b52b4 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -87,25 +87,6 @@ size_t align_string(const void *base_ptr, const char *p, int flags); size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate); int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src); -/* The following definitions come from lib/conn_tdb.c */ - -struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx, - connection_struct *conn, - const char *name); -int connections_traverse(int (*fn)(struct db_record *rec, - void *private_data), - void *private_data); -int connections_forall(int (*fn)(struct db_record *rec, - const struct connections_key *key, - const struct connections_data *data, - void *private_data), - void *private_data); -int connections_forall_read(int (*fn)(const struct connections_key *key, - const struct connections_data *data, - void *private_data), - void *private_data); -bool connections_init(bool rw); - /* The following definitions come from lib/dmallocmsg.c */ void register_dmalloc_msgs(struct messaging_context *msg_ctx); diff --git a/source3/include/smb.h b/source3/include/smb.h index 245ff7be11..9a63d8252f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -564,31 +564,6 @@ Offset Data length. #define NT_HASH_LEN 16 #define LM_HASH_LEN 16 -/* key and data in the connections database - used in smbstatus and smbd */ -struct connections_key { - struct server_id pid; - int cnum; - fstring name; -}; - -struct connections_data { - int magic; - struct server_id pid; - int cnum; - uid_t uid; - gid_t gid; - char servicename[FSTRING_LEN]; - char addr[24]; - char machine[FSTRING_LEN]; - time_t start; - - /* - * This field used to hold the msg_flags. For compatibility reasons, - * keep the data structure in the tdb file the same. - */ - uint32 unused_compatitibility_field; -}; - /* offsets into message for common items */ #define smb_com (NBT_HDR_SIZE+HDR_COM) #define smb_rcls (NBT_HDR_SIZE+HDR_RCLS) diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c index 9b0a07a56c..776f53ca79 100644 --- a/source3/lib/conn_tdb.c +++ b/source3/lib/conn_tdb.c @@ -23,6 +23,7 @@ #include "dbwrap/dbwrap.h" #include "dbwrap/dbwrap_open.h" #include "messages.h" +#include "lib/conn_tdb.h" static struct db_context *connections_db_ctx(bool rw) { diff --git a/source3/lib/conn_tdb.h b/source3/lib/conn_tdb.h new file mode 100644 index 0000000000..ee4befed16 --- /dev/null +++ b/source3/lib/conn_tdb.h @@ -0,0 +1,62 @@ +/* + Unix SMB/CIFS implementation. + Low-level connections.tdb access functions + Copyright (C) Volker Lendecke 2007 + + 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/>. +*/ + +/* key and data in the connections database - used in smbstatus and smbd */ +struct connections_key { + struct server_id pid; + int cnum; + fstring name; +}; + +struct connections_data { + int magic; + struct server_id pid; + int cnum; + uid_t uid; + gid_t gid; + char servicename[FSTRING_LEN]; + char addr[24]; + char machine[FSTRING_LEN]; + time_t start; + + /* + * This field used to hold the msg_flags. For compatibility reasons, + * keep the data structure in the tdb file the same. + */ + uint32 unused_compatitibility_field; +}; + +/* The following definitions come from lib/conn_tdb.c */ + +struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx, + connection_struct *conn, + const char *name); +int connections_traverse(int (*fn)(struct db_record *rec, + void *private_data), + void *private_data); +int connections_forall(int (*fn)(struct db_record *rec, + const struct connections_key *key, + const struct connections_data *data, + void *private_data), + void *private_data); +int connections_forall_read(int (*fn)(const struct connections_key *key, + const struct connections_data *data, + void *private_data), + void *private_data); +bool connections_init(bool rw); diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 38f272c55a..d351468dce 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -37,6 +37,7 @@ #include "smbd/globals.h" #include "auth.h" #include "messages.h" +#include "lib/conn_tdb.h" extern const struct generic_mapping file_generic_mapping; diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 38615d5445..01eb9d79f7 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -24,6 +24,7 @@ #include "auth.h" #include "../lib/tsocket/tsocket.h" #include "messages.h" +#include "lib/conn_tdb.h" /**************************************************************************** Delete a connection record. diff --git a/source3/smbd/server.c b/source3/smbd/server.c index f71235f19f..c1cc15e8c5 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -42,6 +42,7 @@ #include "lib/id_cache.h" #include "lib/param/param.h" #include "lib/background.h" +#include "lib/conn_tdb.h" struct smbd_open_socket; struct smbd_child_pid; diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index f9ba9769b5..c0d44500f3 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -36,6 +36,7 @@ #include "smbprofile.h" #include "../libcli/security/security.h" #include "auth/gensec/gensec.h" +#include "lib/conn_tdb.h" /**************************************************************************** Add the standard 'Samba' signature to the end of the session setup. diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c index 31322e27e7..79be5477c5 100644 --- a/source3/utils/net_serverid.c +++ b/source3/utils/net_serverid.c @@ -22,6 +22,7 @@ #include "dbwrap/dbwrap.h" #include "serverid.h" #include "session.h" +#include "lib/conn_tdb.h" static int net_serverid_list_fn(const struct server_id *id, uint32_t msg_flags, void *priv) diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c index d6027433a2..2bb639138e 100644 --- a/source3/utils/net_status.c +++ b/source3/utils/net_status.c @@ -20,6 +20,7 @@ #include "utils/net.h" #include "session.h" #include "messages.h" +#include "lib/conn_tdb.h" int net_status_usage(struct net_context *c, int argc, const char **argv) { diff --git a/source3/utils/status.c b/source3/utils/status.c index 95b279ea3b..66aec53f17 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -42,6 +42,7 @@ #include "librpc/gen_ndr/open_files.h" #include "smbd/proto.h" #include "librpc/gen_ndr/notify.h" +#include "lib/conn_tdb.h" #define SMB_MAXPIDS 2048 static uid_t Ucrit_uid = 0; /* added by OH */ diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index 49fb32e4fd..4b3d3aea86 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -22,6 +22,7 @@ #include "libcli/security/security.h" #include "locking/proto.h" #include "librpc/gen_ndr/open_files.h" +#include "lib/conn_tdb.h" #define _(x) lang_msg_rotate(talloc_tos(),x) |