identification: parse identities having a "@@" prefix as ID_RFC822_ADDR
Original patch by Gerald Richter.
This commit is contained in:
@@ -1000,23 +1000,23 @@ identification_t *identification_create_from_string(char *string)
|
|||||||
{
|
{
|
||||||
if (*string == '@')
|
if (*string == '@')
|
||||||
{
|
{
|
||||||
if (*(string + 1) == '#')
|
string++;
|
||||||
|
if (*string == '#')
|
||||||
{
|
{
|
||||||
this = identification_create(ID_KEY_ID);
|
this = identification_create(ID_KEY_ID);
|
||||||
string += 2;
|
this->encoded = chunk_from_hex(chunk_from_str(string + 1), NULL);
|
||||||
this->encoded = chunk_from_hex(
|
return &this->public;
|
||||||
chunk_create(string, strlen(string)), NULL);
|
}
|
||||||
|
else if (*string == '@')
|
||||||
|
{
|
||||||
|
this = identification_create(ID_USER_FQDN);
|
||||||
|
this->encoded = chunk_clone(chunk_from_str(string + 1));
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this = identification_create(ID_FQDN);
|
this = identification_create(ID_FQDN);
|
||||||
string += 1;
|
this->encoded = chunk_clone(chunk_from_str(string));
|
||||||
this->encoded.len = strlen(string);
|
|
||||||
if (this->encoded.len)
|
|
||||||
{ /* if we only got an @ */
|
|
||||||
this->encoded.ptr = strdup(string);
|
|
||||||
}
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1093,4 +1093,3 @@ identification_t *identification_create_from_sockaddr(sockaddr_t *sockaddr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user