Skip to content

Commit

Permalink
lib/srdb1: use last @ as delimiter for start of host in db url
Browse files Browse the repository at this point in the history
- allow @ to be part of password
- reported by GH#169, Debojit Kakoti

(cherry picked from commit c02e165)
  • Loading branch information
miconda committed Jun 24, 2015
1 parent d266a05 commit efd63b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/srdb1/db_id.c
Expand Up @@ -83,7 +83,7 @@ static int parse_db_url(struct db_id* id, const str* url)
};

enum state st;
unsigned int len, i;
unsigned int len, i, j, a;
const char* begin;
char* prev_token;

Expand Down Expand Up @@ -164,6 +164,14 @@ static int parse_db_url(struct db_id* id, const str* url)
st = ST_HOST;
id->username = prev_token;
prev_token = 0;
a = 0;
/* go to last '@' to support when it is part of password */
for(j = i+1; j < len; j++) {
if(url->s[j]=='@') {
a = j;
}
}
if(a!=0) i = a;
if (dupl_string(&id->password, begin, url->s + i) < 0) goto err;
begin = url->s + i + 1;
break;
Expand Down

0 comments on commit efd63b6

Please sign in to comment.