30 if(local == NULL) local =
"";
31 if(remote == NULL) remote =
"";
34 key = (
char *) malloc(strlen(local) + strlen(remote) + 2);
36 key = (
char *)
pmalloc(p, strlen(local) + strlen(remote) + 2);
38 sprintf(key,
"%s/%s", local, remote);
45 char *klocal, *kremote;
48 klocal = strndup(rkey, rkeylen);
49 kremote = strchr(klocal,
'/');
50 if(kremote != NULL) *kremote++ =
'\0';
52 ret = (local == NULL || (klocal != NULL && !strcmp(local, klocal)))
53 && (remote == NULL || (kremote != NULL && !strcmp(remote, kremote)));
62 char hash[41], buf[1024];
64 _sx_debug(
ZONE,
"generating dialback key, secret %s, remote %s, id %s", secret, remote,
id);
68 snprintf(buf, 1024,
"%s%s", hash, remote);
71 snprintf(buf, 1024,
"%s%s", hash,
id);
void * pmalloc(pool_t p, int size)
void shahash_r(const char *str, char hashbuf[41])
convenience (originally by Thomas Muldowney)
char * s2s_route_key(pool_t p, const char *local, const char *remote)
generate a local/remote route key
char * s2s_db_key(pool_t p, const char *secret, const char *remote, const char *id)
generate a dialback key
int s2s_route_key_match(char *local, const char *remote, const char *rkey, int rkeylen)
match route key - used for searching route hash
char * pstrdup(pool_t p, const char *src)
XXX efficient: move this to const char * and then loop throug the existing heaps to see if src is wit...
pool - base node for a pool.