summaryrefslogtreecommitdiff
path: root/cldap_ping.h
diff options
context:
space:
mode:
authorDavid Voit <david.voit@gmail.com>2024-04-03 07:24:48 +0200
committerPavel Shilovsky <pshilovsky@samba.org>2024-04-28 00:00:12 +0000
commitc6bf4d9a59809fbb0c22ef9eb167c099ab8089fb (patch)
tree9086346733731671d164c73131f1d3467d7022c6 /cldap_ping.h
parent4718e09e4b15b957bf9d729793bc3de7caad8134 (diff)
downloadcifs-utils-for-next.tar.gz
cifs-utils-for-next.tar.bz2
cifs-utils-for-next.zip
Implement CLDAP Ping to find the closest sitefor-next
For domain based DFS we always need to contact the domain controllers. On setups, which are using bigger AD installations you could get random dc on the other side of the world, if you don't have site support. This can lead to network timeouts and other problems. CLDAP-Ping uses ASN.1 + UDP (CLDAP) and custom-DCE encoding including DName compressions without field separation. Finally after finding the sitename we now need to do a DNS SRV lookups to find the correct IPs to our closest site and fill up the remaining IPs from the global list. Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Reviewed-by: Jacob Shivers <jshivers@redhat.com> Signed-off-by: David Voit <david.voit@gmail.com>
Diffstat (limited to 'cldap_ping.h')
-rw-r--r--cldap_ping.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/cldap_ping.h b/cldap_ping.h
new file mode 100644
index 0000000..9a23e72
--- /dev/null
+++ b/cldap_ping.h
@@ -0,0 +1,14 @@
+#ifndef _CLDAP_PING_H_
+#define _CLDAP_PING_H_
+
+#define CLDAP_PING_NETWORK_ERROR -1
+#define CLDAP_PING_TRYNEXT -2
+#define CLDAP_PING_PARSE_ERROR_LDAP -3
+#define CLDAP_PING_PARSE_ERROR_NETLOGON -4
+
+// returns CLDAP_PING_TRYNEXT if you should use another dc
+// any other error code < 0 is a fatal error
+// site_name must be of MAXCDNAME size!
+int cldap_ping(char *domain, sa_family_t family, void *addr, char *site_name);
+
+#endif /* _CLDAP_PING_H_ */