aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-11-25 09:41:42 +0000
committerFreeArtMan <dos21h@gmail.com>2017-11-25 09:41:42 +0000
commit3967218650a2c03304533c4e8b32e86c8b38a48a (patch)
treefdb1a35522a60607b2d2efb4bc06083272864939
parentaee6daa406af77c16e209927f51e56034be6d773 (diff)
downloadagni-3967218650a2c03304533c4e8b32e86c8b38a48a.tar.gz
agni-3967218650a2c03304533c4e8b32e86c8b38a48a.zip
Bug in todo handling usernames, needed to use base64 encoded username
-rw-r--r--cmd/cmd_todo.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/cmd_todo.c b/cmd/cmd_todo.c
index 78dc8b5..079866e 100644
--- a/cmd/cmd_todo.c
+++ b/cmd/cmd_todo.c
@@ -145,18 +145,20 @@ static int del_todo(sqlite3 *db, char *user, int id)
char *b64_user;
b64_user = b64_encode(user, strlen(user));
- snprintf(sql_del_table, 1024, "DELETE FROM todo WHERE user='%s' AND id=%d;", user, id);
+ snprintf(sql_del_table, 1024, "DELETE FROM todo WHERE user='%s' AND id=%d;", b64_user, id);
free(b64_user);
+ PRINT("%s\n",sql_del_table);
if ((rc = sqlite3_exec(db, sql_del_table, 0, 0, &err_msg )) != SQLITE_OK)
{
printf("Cant del todo: %s\n", err_msg);
sqlite3_free(err_msg);
-
+ PNL();
return -1;
}
+ PNL();
return 0;
}
@@ -284,6 +286,7 @@ void *cmd_todo(void *data)
if (count > 2)
{
int id = atoi(tokens[2]);
+ PRINT("%d\n",id);
del_todo(db, req->user, id);
}