allow to pass no api_key when constructing the signature

This commit is contained in:
josch
2014-09-23 18:53:16 +02:00
parent 60e0824f68
commit 036954df35
3 changed files with 23 additions and 7 deletions

View File

@@ -94,8 +94,13 @@ const char *mfconn_create_user_signature(mfconn * conn,
if (conn == NULL)
return NULL;
signature_raw = strdup_printf("%s%s%d%s",
username, password, app_id, app_key);
if (app_key == NULL) {
signature_raw = strdup_printf("%s%s%d",
username, password, app_id);
} else {
signature_raw = strdup_printf("%s%s%d%s",
username, password, app_id, app_key);
}
SHA1((const unsigned char *)signature_raw,
strlen(signature_raw), signature_enc);