From: Zdeněk Salvet Date: Thu, 23 Aug 2007 07:29:59 +0000 (+0000) Subject: Add edg_wll_gss_normalize_subj(). Converts /emailAddress= to /Email= X-Git-Tag: glite-security-gsoap-plugin_R_1_5_0_1~3 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=1cff362d69fd14b596338f2f4d0d575b6e71ddea;p=jra1mw.git Add edg_wll_gss_normalize_subj(). Converts /emailAddress= to /Email= and strips /CN=proxy. --- diff --git a/org.glite.security.gsoap-plugin/src/glite_gss.c b/org.glite.security.gsoap-plugin/src/glite_gss.c index b3b4198..359c54c 100644 --- a/org.glite.security.gsoap-plugin/src/glite_gss.c +++ b/org.glite.security.gsoap-plugin/src/glite_gss.c @@ -1064,3 +1064,29 @@ edg_wll_gss_reject(int sock) /* XXX is it possible to cut & paste edg_wll_ssl_reject() ? */ return 0; } + +char * +edg_wll_gss_normalize_subj(char *in, int replace_in) +{ + char *new, *ptr; + size_t len; + + if (in == NULL) return NULL; + if (replace_in) + new = in; + else + new = strdup(in); + + while ((ptr = strstr(new, "/emailAddress="))) { + memcpy(ptr, "/Email=",7); + memmove(ptr+7, ptr+14, strlen(ptr+14)+1); + } + + len = strlen(new); + while (len > 9 && !strcmp(new+len-9, "/CN=proxy")) { + *(new+len-9) = '\0'; + len -= 9; + } + + return new; +}