From 2b41f421fd14cb2190b43dbf079c734e7024335c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 18 Aug 2010 18:13:42 +0200 Subject: s3-idmap: only include idmap headers where needed. Guenther --- source3/include/idmap.h | 4 +++ source3/include/includes.h | 1 - source3/include/proto.h | 49 -------------------------- source3/include/smb.h | 1 - source3/lib/idmap_cache.c | 1 + source3/lib/idmap_cache.h | 10 ++++++ source3/passdb/lookup_sid.c | 1 + source3/passdb/pdb_ldap.c | 1 + source3/utils/net_idmap.c | 1 + source3/winbindd/idmap.c | 1 + source3/winbindd/idmap_ad.c | 1 + source3/winbindd/idmap_adex/cell_util.c | 1 + source3/winbindd/idmap_adex/domain_util.c | 1 + source3/winbindd/idmap_adex/gc_util.c | 1 + source3/winbindd/idmap_adex/idmap_adex.c | 1 + source3/winbindd/idmap_adex/likewise_cell.c | 1 + source3/winbindd/idmap_adex/provider_unified.c | 1 + source3/winbindd/idmap_hash/idmap_hash.c | 1 + source3/winbindd/idmap_hash/mapfile.c | 1 + source3/winbindd/idmap_ldap.c | 1 + source3/winbindd/idmap_nss.c | 1 + source3/winbindd/idmap_passdb.c | 1 + source3/winbindd/idmap_proto.h | 36 +++++++++++++++++++ source3/winbindd/idmap_rid.c | 1 + source3/winbindd/idmap_tdb.c | 1 + source3/winbindd/idmap_tdb2.c | 1 + source3/winbindd/idmap_util.c | 2 ++ source3/winbindd/wb_gid2sid.c | 2 ++ source3/winbindd/wb_sid2gid.c | 1 + source3/winbindd/wb_sid2uid.c | 1 + source3/winbindd/wb_uid2sid.c | 2 ++ source3/winbindd/winbindd.c | 1 + source3/winbindd/winbindd_dual_srv.c | 1 + 33 files changed, 80 insertions(+), 51 deletions(-) create mode 100644 source3/lib/idmap_cache.h create mode 100644 source3/winbindd/idmap_proto.h diff --git a/source3/include/idmap.h b/source3/include/idmap.h index aab41cd7d3..8a1da81e39 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -30,6 +30,8 @@ #define SMB_IDMAP_INTERFACE_VERSION 5 +#include "librpc/gen_ndr/idmap.h" + struct idmap_domain { const char *name; struct idmap_methods *methods; @@ -60,4 +62,6 @@ struct idmap_methods { NTSTATUS (*close_fn)(struct idmap_domain *dom); }; +#include "winbindd/idmap_proto.h" + #endif /* _IDMAP_H_ */ diff --git a/source3/include/includes.h b/source3/include/includes.h index d409a354a1..e65ea437ed 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -653,7 +653,6 @@ struct ntlmssp_state; #include "auth.h" #include "ntdomain.h" #include "librpc/rpc/dcerpc.h" -#include "idmap.h" #include "client.h" #include "session.h" diff --git a/source3/include/proto.h b/source3/include/proto.h index 7728af3ff5..87b2e275ad 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5653,55 +5653,6 @@ NTSTATUS vfs_stat_fsp(files_struct *fsp); char *stdin_new_passwd( void); char *get_pass( const char *prompt, bool stdin_get); -/* The following definitions come from winbindd/idmap.c */ - -bool idmap_is_offline(void); -bool idmap_is_online(void); -NTSTATUS smb_register_idmap(int version, const char *name, - struct idmap_methods *methods); -void idmap_close(void); -NTSTATUS idmap_init_cache(void); -NTSTATUS idmap_allocate_uid(struct unixid *id); -NTSTATUS idmap_allocate_gid(struct unixid *id); -NTSTATUS idmap_backends_unixid_to_sid(const char *domname, - struct id_map *id); -NTSTATUS idmap_backends_sid_to_unixid(const char *domname, - struct id_map *id); -NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type, - struct unixid *pxid); - -/* The following definitions come from winbindd/idmap_cache.c */ - -bool idmap_cache_find_sid2uid(const struct dom_sid *sid, uid_t *puid, - bool *expired); -bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired); -void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid); -bool idmap_cache_find_sid2gid(const struct dom_sid *sid, gid_t *pgid, - bool *expired); -bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired); -void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid); - - -/* The following definitions come from winbindd/idmap_nss.c */ - -NTSTATUS idmap_nss_init(void); - -/* The following definitions come from winbindd/idmap_passdb.c */ - -NTSTATUS idmap_passdb_init(void); - -/* The following definitions come from winbindd/idmap_tdb.c */ - -NTSTATUS idmap_tdb_init(void); - -/* The following definitions come from winbindd/idmap_util.c */ - -NTSTATUS idmap_uid_to_sid(const char *domname, struct dom_sid *sid, uid_t uid); -NTSTATUS idmap_gid_to_sid(const char *domname, struct dom_sid *sid, gid_t gid); -NTSTATUS idmap_sid_to_uid(const char *dom_name, struct dom_sid *sid, uid_t *uid); -NTSTATUS idmap_sid_to_gid(const char *domname, struct dom_sid *sid, gid_t *gid); -bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom); - /* The following definitions come from winbindd/nss_info.c */ diff --git a/source3/include/smb.h b/source3/include/smb.h index 05a02637bd..74f1eb535a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -174,7 +174,6 @@ typedef union unid_t { |LOOKUP_NAME_WKN\ |LOOKUP_NAME_DOMAIN) -#include "librpc/gen_ndr/idmap.h" #include "librpc/gen_ndr/epmapper.h" #include "librpc/gen_ndr/dcerpc.h" diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c index 6377635a65..bf72d91efe 100644 --- a/source3/lib/idmap_cache.c +++ b/source3/lib/idmap_cache.c @@ -18,6 +18,7 @@ along with this program. If not, see .*/ #include "includes.h" +#include "idmap_cache.h" /** * Find a sid2uid mapping diff --git a/source3/lib/idmap_cache.h b/source3/lib/idmap_cache.h new file mode 100644 index 0000000000..f511780672 --- /dev/null +++ b/source3/lib/idmap_cache.h @@ -0,0 +1,10 @@ +/* The following definitions come from lib/idmap_cache.c */ + +bool idmap_cache_find_sid2uid(const struct dom_sid *sid, uid_t *puid, + bool *expired); +bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired); +void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid); +bool idmap_cache_find_sid2gid(const struct dom_sid *sid, gid_t *pgid, + bool *expired); +bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired); +void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid); diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index a93145330b..0e2385f43f 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -23,6 +23,7 @@ #include "../librpc/gen_ndr/ndr_security.h" #include "secrets.h" #include "memcache.h" +#include "idmap_cache.h" /***************************************************************** Dissect a user-provided name into domain, name, sid and type. diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index ef695f1c1a..e3dedcd06e 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -46,6 +46,7 @@ #include "includes.h" #include "../libcli/auth/libcli_auth.h" #include "secrets.h" +#include "idmap_cache.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index cd3a68db3c..8bcb79fabf 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -21,6 +21,7 @@ #include "includes.h" #include "utils/net.h" #include "secrets.h" +#include "idmap.h" #define ALLOC_CHECK(mem) do { \ if (!mem) { \ diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index 2a4e2a5a43..102f4ebb7f 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -22,6 +22,7 @@ #include "includes.h" #include "winbindd.h" +#include "idmap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c index a690fb2b36..3d47baadc9 100644 --- a/source3/winbindd/idmap_ad.c +++ b/source3/winbindd/idmap_ad.c @@ -32,6 +32,7 @@ #include "libads/ldap_schema.h" #include "nss_info.h" #include "secrets.h" +#include "idmap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/idmap_adex/cell_util.c b/source3/winbindd/idmap_adex/cell_util.c index c32bb9179d..c82407c0f4 100644 --- a/source3/winbindd/idmap_adex/cell_util.c +++ b/source3/winbindd/idmap_adex/cell_util.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ads.h" +#include "idmap.h" #include "idmap_adex.h" #include "../libds/common/flags.h" diff --git a/source3/winbindd/idmap_adex/domain_util.c b/source3/winbindd/idmap_adex/domain_util.c index 72643e97da..c373106446 100644 --- a/source3/winbindd/idmap_adex/domain_util.c +++ b/source3/winbindd/idmap_adex/domain_util.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ads.h" +#include "idmap.h" #include "idmap_adex.h" #undef DBGC_CLASS diff --git a/source3/winbindd/idmap_adex/gc_util.c b/source3/winbindd/idmap_adex/gc_util.c index 339234dfaf..56bd9542f6 100644 --- a/source3/winbindd/idmap_adex/gc_util.c +++ b/source3/winbindd/idmap_adex/gc_util.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ads.h" +#include "idmap.h" #include "idmap_adex.h" #include "libads/cldap.h" diff --git a/source3/winbindd/idmap_adex/idmap_adex.c b/source3/winbindd/idmap_adex/idmap_adex.c index 5e55df357e..0902d55470 100644 --- a/source3/winbindd/idmap_adex/idmap_adex.c +++ b/source3/winbindd/idmap_adex/idmap_adex.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ads.h" +#include "idmap.h" #include "idmap_adex.h" #include "nss_info.h" #include "secrets.h" diff --git a/source3/winbindd/idmap_adex/likewise_cell.c b/source3/winbindd/idmap_adex/likewise_cell.c index 3e529b427a..00ccc597bb 100644 --- a/source3/winbindd/idmap_adex/likewise_cell.c +++ b/source3/winbindd/idmap_adex/likewise_cell.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ads.h" +#include "idmap.h" #include "idmap_adex.h" #include "secrets.h" diff --git a/source3/winbindd/idmap_adex/provider_unified.c b/source3/winbindd/idmap_adex/provider_unified.c index 999615ca3c..191f77159c 100644 --- a/source3/winbindd/idmap_adex/provider_unified.c +++ b/source3/winbindd/idmap_adex/provider_unified.c @@ -22,6 +22,7 @@ #include "includes.h" #include "ads.h" +#include "idmap.h" #include "idmap_adex.h" #undef DBGC_CLASS diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c index ed55cd5dd4..f6c8652463 100644 --- a/source3/winbindd/idmap_hash/idmap_hash.c +++ b/source3/winbindd/idmap_hash/idmap_hash.c @@ -20,6 +20,7 @@ #include "includes.h" #include "winbindd/winbindd.h" +#include "idmap.h" #include "idmap_hash.h" #include "ads.h" #include "nss_info.h" diff --git a/source3/winbindd/idmap_hash/mapfile.c b/source3/winbindd/idmap_hash/mapfile.c index 5ab1142ffe..199dded87f 100644 --- a/source3/winbindd/idmap_hash/mapfile.c +++ b/source3/winbindd/idmap_hash/mapfile.c @@ -20,6 +20,7 @@ #include "includes.h" #include "winbindd/winbindd.h" +#include "idmap.h" #include "idmap_hash.h" #include diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c index 51915002b5..39df489be7 100644 --- a/source3/winbindd/idmap_ldap.c +++ b/source3/winbindd/idmap_ldap.c @@ -26,6 +26,7 @@ #include "includes.h" #include "winbindd.h" #include "secrets.h" +#include "idmap.h" #include "idmap_rw.h" #undef DBGC_CLASS diff --git a/source3/winbindd/idmap_nss.c b/source3/winbindd/idmap_nss.c index 40adef29b8..ac5dd797fa 100644 --- a/source3/winbindd/idmap_nss.c +++ b/source3/winbindd/idmap_nss.c @@ -22,6 +22,7 @@ #include "includes.h" #include "winbindd.h" #include "nsswitch/winbind_client.h" +#include "idmap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/idmap_passdb.c b/source3/winbindd/idmap_passdb.c index 4dcf74416c..ece1b42122 100644 --- a/source3/winbindd/idmap_passdb.c +++ b/source3/winbindd/idmap_passdb.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "idmap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/idmap_proto.h b/source3/winbindd/idmap_proto.h new file mode 100644 index 0000000000..42900a6690 --- /dev/null +++ b/source3/winbindd/idmap_proto.h @@ -0,0 +1,36 @@ +/* The following definitions come from winbindd/idmap.c */ + +bool idmap_is_offline(void); +bool idmap_is_online(void); +NTSTATUS smb_register_idmap(int version, const char *name, + struct idmap_methods *methods); +void idmap_close(void); +NTSTATUS idmap_init_cache(void); +NTSTATUS idmap_allocate_uid(struct unixid *id); +NTSTATUS idmap_allocate_gid(struct unixid *id); +NTSTATUS idmap_backends_unixid_to_sid(const char *domname, + struct id_map *id); +NTSTATUS idmap_backends_sid_to_unixid(const char *domname, + struct id_map *id); +NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type, + struct unixid *pxid); + +/* The following definitions come from winbindd/idmap_nss.c */ + +NTSTATUS idmap_nss_init(void); + +/* The following definitions come from winbindd/idmap_passdb.c */ + +NTSTATUS idmap_passdb_init(void); + +/* The following definitions come from winbindd/idmap_tdb.c */ + +NTSTATUS idmap_tdb_init(void); + +/* The following definitions come from winbindd/idmap_util.c */ + +NTSTATUS idmap_uid_to_sid(const char *domname, struct dom_sid *sid, uid_t uid); +NTSTATUS idmap_gid_to_sid(const char *domname, struct dom_sid *sid, gid_t gid); +NTSTATUS idmap_sid_to_uid(const char *dom_name, struct dom_sid *sid, uid_t *uid); +NTSTATUS idmap_sid_to_gid(const char *domname, struct dom_sid *sid, gid_t *gid); +bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom); diff --git a/source3/winbindd/idmap_rid.c b/source3/winbindd/idmap_rid.c index 6e948025d2..982c4fde69 100644 --- a/source3/winbindd/idmap_rid.c +++ b/source3/winbindd/idmap_rid.c @@ -20,6 +20,7 @@ #include "includes.h" #include "winbindd.h" +#include "idmap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index d00ffbe901..d04541fc24 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -25,6 +25,7 @@ #include "includes.h" #include "winbindd.h" +#include "idmap.h" #include "idmap_rw.h" #undef DBGC_CLASS diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index d30b105ba0..77ebbebc66 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -33,6 +33,7 @@ #include "includes.h" #include "winbindd.h" +#include "idmap.h" #include "idmap_rw.h" #undef DBGC_CLASS diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c index 3afe9f8607..d743f8ce23 100644 --- a/source3/winbindd/idmap_util.c +++ b/source3/winbindd/idmap_util.c @@ -20,6 +20,8 @@ #include "includes.h" #include "winbindd.h" #include "winbindd_proto.h" +#include "idmap.h" +#include "idmap_cache.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/wb_gid2sid.c b/source3/winbindd/wb_gid2sid.c index 0937590a52..d4416f1a76 100644 --- a/source3/winbindd/wb_gid2sid.c +++ b/source3/winbindd/wb_gid2sid.c @@ -20,6 +20,8 @@ #include "includes.h" #include "winbindd.h" #include "librpc/gen_ndr/cli_wbint.h" +#include "idmap_cache.h" +#include "idmap.h" struct wb_gid2sid_state { struct tevent_context *ev; diff --git a/source3/winbindd/wb_sid2gid.c b/source3/winbindd/wb_sid2gid.c index 4d76d69297..15cf394e2f 100644 --- a/source3/winbindd/wb_sid2gid.c +++ b/source3/winbindd/wb_sid2gid.c @@ -20,6 +20,7 @@ #include "includes.h" #include "winbindd.h" #include "librpc/gen_ndr/cli_wbint.h" +#include "idmap_cache.h" struct wb_sid2gid_state { struct tevent_context *ev; diff --git a/source3/winbindd/wb_sid2uid.c b/source3/winbindd/wb_sid2uid.c index 86bf5d4641..51c70c5715 100644 --- a/source3/winbindd/wb_sid2uid.c +++ b/source3/winbindd/wb_sid2uid.c @@ -20,6 +20,7 @@ #include "includes.h" #include "winbindd.h" #include "librpc/gen_ndr/cli_wbint.h" +#include "idmap_cache.h" struct wb_sid2uid_state { struct tevent_context *ev; diff --git a/source3/winbindd/wb_uid2sid.c b/source3/winbindd/wb_uid2sid.c index 9e86fd5a01..857066844c 100644 --- a/source3/winbindd/wb_uid2sid.c +++ b/source3/winbindd/wb_uid2sid.c @@ -20,6 +20,8 @@ #include "includes.h" #include "winbindd.h" #include "librpc/gen_ndr/cli_wbint.h" +#include "idmap_cache.h" +#include "idmap.h" struct wb_uid2sid_state { struct tevent_context *ev; diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 966ebadaea..4163230a95 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -31,6 +31,7 @@ #include "../librpc/gen_ndr/srv_lsa.h" #include "../librpc/gen_ndr/srv_samr.h" #include "secrets.h" +#include "idmap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index 706b691da8..4c6fb97e70 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -25,6 +25,7 @@ #include "winbindd/winbindd_proto.h" #include "librpc/gen_ndr/srv_wbint.h" #include "../librpc/gen_ndr/cli_netlogon.h" +#include "idmap.h" void _wbint_Ping(struct pipes_struct *p, struct wbint_Ping *r) { -- cgit