summaryrefslogtreecommitdiff
path: root/source3/include
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
commit1f31ace6cb771d7bf0b64091fba1d24c466ad4e5 (patch)
tree2260029015c2737d7d53eb82c2368182fd775098 /source3/include
parent105fe2a32eccc63f63ddf903278b80fb211f05bf (diff)
downloadsamba-1f31ace6cb771d7bf0b64091fba1d24c466ad4e5.tar.gz
samba-1f31ace6cb771d7bf0b64091fba1d24c466ad4e5.tar.bz2
samba-1f31ace6cb771d7bf0b64091fba1d24c466ad4e5.zip
much better ADS error handling system
(This used to be commit 05a90a28843e0d69183a49a76617c5f32817df16)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/ads.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/source3/include/ads.h b/source3/include/ads.h
index 4a20d0e79f..884f2aa6ef 100644
--- a/source3/include/ads.h
+++ b/source3/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