Implemented feature that allows users to delete passwords if needed.
This commit is contained in:
parent
e282ff5f7f
commit
a0347a7ca4
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#define add(ptr, index, value) ptr[index] = value //@param ptr Pointer to add the value @param index Index of the value to add @param value Value to add
|
||||
#define remove(ptr, index) ptr[index] = 0 //@param ptr Pointer to remove the value @param index Index of the value to remove
|
||||
#define removePTR(ptr, index) ptr[index] = 0 //@param ptr Pointer to remove the value @param index Index of the value to remove
|
||||
|
||||
#ifdef __INTELLISENSE__
|
||||
#define create(type) ((type *)malloc(sizeof(type))) //@param type Type of the vector @example int *vector = create(int);
|
||||
|
||||
22
src/server.c
22
src/server.c
@ -170,6 +170,28 @@ int main(void)
|
||||
emcryptText(key2, req.key);
|
||||
writel(filepath, key2, 256);
|
||||
}
|
||||
else if (req.type == 2)
|
||||
{
|
||||
// debug
|
||||
printf("Received request type 2\n");
|
||||
|
||||
char filepath[256];
|
||||
|
||||
printf("Received key: %s\n", req.key);
|
||||
printf("Received level: %d\n", req.level);
|
||||
sprintf(filepath, "%s%d.bin", PASSWORDS, req.level);
|
||||
|
||||
printf("Deleting key from file: %s\n", filepath);
|
||||
|
||||
if (remove(filepath) != 0)
|
||||
{
|
||||
fprintf(stderr, "Error deleting file\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Invalid request type\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Close the socket
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user