Browse code

- GET_REALM v2

Jan Janak authored on 01/02/2005 12:35:17
Showing 1 changed files
... ...
@@ -97,6 +97,21 @@ typedef struct dig_cred {
97 97
 } dig_cred_t;
98 98
 
99 99
 
100
+/*
101
+ * Macro to obtain the value of realm. The macro would first
102
+ * check if there is any @domain part in the username and if
103
+ * so, it will be returned as the value of realm. This hack is
104
+ * ofter used to protect realm using the digest (username parameter
105
+ * is protected by the response hash) and also to allow subscribers
106
+ * to specify a different domain part than the one in realm parameter
107
+ */
108
+#define GET_REALM(cred)                                           \
109
+    (((cred)->username.domain.len && (cred)->username.domain.s) ? \
110
+     &(cred)->username.domain :                                   \
111
+     &(cred)->realm)
112
+
113
+
114
+
100 115
 /*
101 116
  * Initialize a digest credentials structure
102 117
  */