Changeset 9d21120
- Timestamp:
- Nov 8, 2010, 4:02:43 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 35d2091
- Parents:
- 1522e5d
- git-author:
- Alejandro R. Sedeño <asedeno@mit.edu> (11/04/10 15:02:02)
- git-committer:
- Alejandro R. Sedeño <asedeno@mit.edu> (11/08/10 16:02:43)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.h
r1522e5d r9d21120 201 201 #define OWL_WEBZEPHYR_CLASS "webzephyr" 202 202 #define OWL_WEBZEPHYR_OPCODE "webzephyr" 203 204 #define OWL_ZEPHYR_NOSTRIP_HOST "host/" 205 #define OWL_ZEPHYR_NOSTRIP_RCMD "rcmd." 206 #define OWL_ZEPHYR_NOSTRIP_DAEMON5 "daemon/" 207 #define OWL_ZEPHYR_NOSTRIP_DAEMON4 "daemon." 203 208 204 209 #define OWL_REGEX_QUOTECHARS "!+*.?[]^\\${}()" -
zephyr.c
r1522e5d r9d21120 1229 1229 1230 1230 /* strip out the instance from a zsender's principal. Preserves the 1231 * realm if present. daemon/webzephyr.mit.edu is a special case. 1232 * The caller must free the return. 1231 * realm if present. Leave host/ and daemon/ krb5 principals 1232 * alone. Also leave rcmd. and daemon. krb4 principals alone. The 1233 * caller must free the return. 1233 1234 */ 1234 1235 char *owl_zephyr_smartstripped_user(const char *in) 1235 1236 { 1236 char * ptr, *realm, *out;1237 1238 out =owl_strdup(in);1237 char *slash, *dot, *realm, *out; 1238 1239 out = owl_strdup(in); 1239 1240 1240 1241 /* bail immeaditly if we don't have to do any work */ 1241 ptr=strchr(out, '.');1242 if (!strchr(out, '/') && !ptr) {1243 /* no '/' and no '.' */1242 slash = strchr(out, '/'); 1243 dot = strchr(out, '.'); 1244 if (!slash && !dot) { 1244 1245 return(out); 1245 1246 } 1246 if (ptr && strchr(out, '@') && (ptr > strchr(out, '@'))) { 1247 /* There's a '.' but it's in the realm */ 1247 1248 if (!strncasecmp(out, OWL_ZEPHYR_NOSTRIP_HOST, strlen(OWL_ZEPHYR_NOSTRIP_HOST)) || 1249 !strncasecmp(out, OWL_ZEPHYR_NOSTRIP_RCMD, strlen(OWL_ZEPHYR_NOSTRIP_RCMD)) || 1250 !strncasecmp(out, OWL_ZEPHYR_NOSTRIP_DAEMON5, strlen(OWL_ZEPHYR_NOSTRIP_DAEMON5)) || 1251 !strncasecmp(out, OWL_ZEPHYR_NOSTRIP_DAEMON4, strlen(OWL_ZEPHYR_NOSTRIP_DAEMON4))) { 1248 1252 return(out); 1249 1253 } 1250 if (!strncasecmp(out, OWL_WEBZEPHYR_PRINCIPAL, strlen(OWL_WEBZEPHYR_PRINCIPAL))) { 1254 1255 realm = strchr(out, '@'); 1256 if (!slash && dot && realm && (dot > realm)) { 1257 /* There's no '/', and the first '.' is in the realm */ 1251 1258 return(out); 1252 1259 } 1253 1260 1254 1261 /* remove the realm from out, but hold on to it */ 1255 realm=strchr(out, '@');1256 1262 if (realm) realm[0]='\0'; 1257 1263 1258 1264 /* strip */ 1259 ptr=strchr(out, '.'); 1260 if (!ptr) ptr=strchr(out, '/'); 1261 ptr[0]='\0'; 1265 if (slash) slash[0] = '\0'; /* krb5 style user/instance */ 1266 else if (dot) dot[0] = '\0'; /* krb4 style user.instance */ 1262 1267 1263 1268 /* reattach the realm if we had one */
Note: See TracChangeset
for help on using the changeset viewer.