s3-libads: move ads_status to a separate header file.
authorGünther Deschner <gd@samba.org>
Mon, 31 May 2010 10:51:58 +0000 (12:51 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 1 Jul 2010 21:20:39 +0000 (23:20 +0200)
Guenther

source3/include/ads.h
source3/include/includes.h
source3/include/proto.h
source3/libads/ads_status.h [new file with mode: 0644]

index 132586fe3109c65a94d1bf67bbd01dc116f2cf92..e48e0a2650d83565954725a3b77d80993febae5c 100644 (file)
@@ -41,21 +41,6 @@ enum wb_posix_mapping {
        WB_POSIX_MAP_UNIXINFO   = 4
 };
 
-/* there are 5 possible types of errors the ads subsystem can produce */
-enum ads_error_type {ENUM_ADS_ERROR_KRB5, ENUM_ADS_ERROR_GSS, 
-                    ENUM_ADS_ERROR_LDAP, ENUM_ADS_ERROR_SYSTEM, ENUM_ADS_ERROR_NT};
-
-typedef struct {
-       enum ads_error_type error_type;
-       union err_state{                
-               int rc;
-               NTSTATUS nt_status;
-       } err;
-       /* For error_type = ENUM_ADS_ERROR_GSS minor_status describe GSS API error */
-       /* Where rc represents major_status of GSS API error */
-       int minor_status;
-} ADS_STATUS;
-
 struct ads_struct;
 
 struct ads_saslwrap_ops {
@@ -169,24 +154,6 @@ typedef LDAPMod **ADS_MODLIST;
 typedef void **ADS_MODLIST;
 #endif
 
-/* macros to simplify error returning */
-#define ADS_ERROR(rc) ADS_ERROR_LDAP(rc)
-#define ADS_ERROR_LDAP(rc) ads_build_error(ENUM_ADS_ERROR_LDAP, rc, 0)
-#define ADS_ERROR_SYSTEM(rc) ads_build_error(ENUM_ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0)
-#define ADS_ERROR_KRB5(rc) ads_build_error(ENUM_ADS_ERROR_KRB5, rc, 0)
-#define ADS_ERROR_GSS(rc, minor) ads_build_error(ENUM_ADS_ERROR_GSS, rc, minor)
-#define ADS_ERROR_NT(rc) ads_build_nt_error(ENUM_ADS_ERROR_NT,rc)
-
-#define ADS_ERR_OK(status) ((status.error_type == ENUM_ADS_ERROR_NT) ? NT_STATUS_IS_OK(status.err.nt_status):(status.err.rc == 0))
-#define ADS_SUCCESS ADS_ERROR(0)
-
-#define ADS_ERROR_HAVE_NO_MEMORY(x) do { \
-        if (!(x)) {\
-                return ADS_ERROR(LDAP_NO_MEMORY);\
-        }\
-} while (0)
-
-
 /* time between reconnect attempts */
 #define ADS_RECONNECT_TIME 5
 
index 6a64db35567cf964692928649369010f6bedb9f9..0638fa3071e3b1fc8747025357ece1a1133fe2ac 100644 (file)
@@ -627,6 +627,7 @@ extern void *cmdline_lp_ctx;
 #include "../lib/util/asn1.h"
 
 #include "krb5_env.h"
+#include "libads/ads_status.h"
 #include "ads.h"
 #include "ads_dns.h"
 #include "interfaces.h"
index 28feec34e2bcd24a97356311a467443fc4925dd9..d41157e7cd3d606b31a800586f22b59182483bfb 100644 (file)
@@ -1753,16 +1753,6 @@ void wins_srv_tags_free(char **list);
 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
 unsigned wins_srv_count_tag(const char *tag);
 
-/* The following definitions come from libads/ads_status.c  */
-
-ADS_STATUS ads_build_error(enum ads_error_type etype, 
-                          int rc, int minor_status);
-ADS_STATUS ads_build_nt_error(enum ads_error_type etype, 
-                          NTSTATUS nt_status);
-NTSTATUS ads_ntstatus(ADS_STATUS status);
-const char *ads_errstr(ADS_STATUS status);
-NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
-
 /* The following definitions come from libads/ads_struct.c  */
 
 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
diff --git a/source3/libads/ads_status.h b/source3/libads/ads_status.h
new file mode 100644 (file)
index 0000000..4c27e16
--- /dev/null
@@ -0,0 +1,42 @@
+
+/* there are 5 possible types of errors the ads subsystem can produce */
+enum ads_error_type {ENUM_ADS_ERROR_KRB5, ENUM_ADS_ERROR_GSS,
+                    ENUM_ADS_ERROR_LDAP, ENUM_ADS_ERROR_SYSTEM, ENUM_ADS_ERROR_NT};
+
+typedef struct {
+       enum ads_error_type error_type;
+       union err_state{
+               int rc;
+               NTSTATUS nt_status;
+       } err;
+       /* For error_type = ENUM_ADS_ERROR_GSS minor_status describe GSS API error */
+       /* Where rc represents major_status of GSS API error */
+       int minor_status;
+} ADS_STATUS;
+
+/* macros to simplify error returning */
+#define ADS_ERROR(rc) ADS_ERROR_LDAP(rc)
+#define ADS_ERROR_LDAP(rc) ads_build_error(ENUM_ADS_ERROR_LDAP, rc, 0)
+#define ADS_ERROR_SYSTEM(rc) ads_build_error(ENUM_ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0)
+#define ADS_ERROR_KRB5(rc) ads_build_error(ENUM_ADS_ERROR_KRB5, rc, 0)
+#define ADS_ERROR_GSS(rc, minor) ads_build_error(ENUM_ADS_ERROR_GSS, rc, minor)
+#define ADS_ERROR_NT(rc) ads_build_nt_error(ENUM_ADS_ERROR_NT,rc)
+
+#define ADS_ERR_OK(status) ((status.error_type == ENUM_ADS_ERROR_NT) ? NT_STATUS_IS_OK(status.err.nt_status):(status.err.rc == 0))
+#define ADS_SUCCESS ADS_ERROR(0)
+
+#define ADS_ERROR_HAVE_NO_MEMORY(x) do { \
+        if (!(x)) {\
+                return ADS_ERROR(LDAP_NO_MEMORY);\
+        }\
+} while (0)
+
+/* The following definitions come from libads/ads_status.c  */
+
+ADS_STATUS ads_build_error(enum ads_error_type etype,
+                          int rc, int minor_status);
+ADS_STATUS ads_build_nt_error(enum ads_error_type etype,
+                          NTSTATUS nt_status);
+NTSTATUS ads_ntstatus(ADS_STATUS status);
+const char *ads_errstr(ADS_STATUS status);
+NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);