summaryrefslogtreecommitdiff
path: root/source/include/ads.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-19 12:21:12 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-19 12:21:12 +0000
commit05a90a28843e0d69183a49a76617c5f32817df16 (patch)
tree5f57ab2af8517c0324932fe349e3beba24c1c7e3 /source/include/ads.h
parent344b786efe00f72ed81f0eeb4d422c655d866557 (diff)
downloadsamba-05a90a28843e0d69183a49a76617c5f32817df16.tar.gz
much better ADS error handling system
Diffstat (limited to 'source/include/ads.h')
-rw-r--r--source/include/ads.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/include/ads.h b/source/include/ads.h
index 4a20d0e79fd..884f2aa6ef7 100644
--- a/source/include/ads.h
+++ b/source/include/ads.h
@@ -18,16 +18,26 @@ typedef struct {
char *server_realm;
} ADS_STRUCT;
+/* there are 4 possible types of errors the ads subsystem can produce */
+enum ads_error_type {ADS_ERROR_KRB5, ADS_ERROR_GSS,
+ ADS_ERROR_LDAP, ADS_ERROR_SYSTEM};
+
typedef struct {
- /* Type of error returned by ads_connect: */
- /* True corresponds GSS API, False - LDAP */
- int error_type;
- /* For error_type = False rc describes LDAP error */
+ enum ads_error_type error_type;
int rc;
- /* For error_type = True rc and minor_status describe GSS API error */
+ /* For error_type = ADS_ERROR_GSS minor_status describe GSS API error */
/* Where rc represents major_status of GSS API error */
int minor_status;
-} ADS_RETURN_CODE;
+} ADS_STATUS;
+
+/* macros to simplify error returning */
+#define ADS_ERROR(rc) ads_build_error(ADS_ERROR_LDAP, rc, 0);
+#define ADS_ERROR_SYSTEM(rc) ads_build_error(ADS_ERROR_SYSTEM, rc, 0);
+#define ADS_ERROR_KRB5(rc) ads_build_error(ADS_ERROR_KRB5, rc, 0);
+#define ADS_ERROR_GSS(rc, minor) ads_build_error(ADS_ERROR_GSS, rc, minor);
+
+#define ADS_ERR_OK(status) ((status).rc == 0)
+#define ADS_SUCCESS ADS_ERROR(0)
/* time between reconnect attempts */
#define ADS_RECONNECT_TIME 5