diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.c | 6 | ||||
-rw-r--r-- | src/client.h | 4 | ||||
-rw-r--r-- | src/command.c | 14 | ||||
-rw-r--r-- | src/permission.c | 16 | ||||
-rw-r--r-- | src/permission.h | 4 |
5 files changed, 22 insertions, 22 deletions
diff --git a/src/client.c b/src/client.c index b0cd8c8d7..f3f5f44ad 100644 --- a/src/client.c +++ b/src/client.c @@ -72,7 +72,7 @@ struct client { size_t bufferPos; int fd; /* file descriptor; -1 if expired */ - int permission; + unsigned permission; /** the uid of the client process, or -1 if unknown */ int uid; @@ -115,12 +115,12 @@ int client_get_uid(const struct client *client) return client->uid; } -int client_get_permission(const struct client *client) +unsigned client_get_permission(const struct client *client) { return client->permission; } -void client_set_permission(struct client *client, int permission) +void client_set_permission(struct client *client, unsigned permission) { client->permission = permission; } diff --git a/src/client.h b/src/client.h index 58c2003de..64ba33b14 100644 --- a/src/client.h +++ b/src/client.h @@ -43,9 +43,9 @@ int client_is_expired(const struct client *client); */ int client_get_uid(const struct client *client); -int client_get_permission(const struct client *client); +unsigned client_get_permission(const struct client *client); -void client_set_permission(struct client *client, int permission); +void client_set_permission(struct client *client, unsigned permission); /** * Write a block of data to the client. diff --git a/src/command.c b/src/command.c index 844ce8e9a..0eb285dfc 100644 --- a/src/command.c +++ b/src/command.c @@ -138,7 +138,7 @@ struct _CommandEntry { const char *cmd; int min; int max; - int reqPermission; + unsigned reqPermission; CommandHandlerFunction handler; }; @@ -272,7 +272,7 @@ static int print_playlist_result(struct client *client, } static void addCommand(const char *name, - int reqPermission, + unsigned reqPermission, int minargs, int maxargs, CommandHandlerFunction handler_func) @@ -1124,7 +1124,7 @@ static int handlePing(mpd_unused struct client *client, static int handlePassword(struct client *client, mpd_unused int argc, char *argv[]) { - int permission = 0; + unsigned permission = 0; if (getPermissionFromPassword(argv[1], &permission) < 0) { command_error(client, ACK_ERROR_PASSWORD, "incorrect password"); @@ -1192,7 +1192,7 @@ static int handleDevices(struct client *client, static int handleCommands(struct client *client, mpd_unused int argc, mpd_unused char *argv[]) { - const int permission = client_get_permission(client); + const unsigned permission = client_get_permission(client); ListNode *node = commandList->firstNode; CommandEntry *cmd; @@ -1211,7 +1211,7 @@ static int handleCommands(struct client *client, static int handleNotcommands(struct client *client, mpd_unused int argc, mpd_unused char *argv[]) { - const int permission = client_get_permission(client); + const unsigned permission = client_get_permission(client); ListNode *node = commandList->firstNode; CommandEntry *cmd; @@ -1348,7 +1348,7 @@ void finishCommands(void) } static int checkArgcAndPermission(CommandEntry * cmd, struct client *client, - int permission, int argc, char *argv[]) + unsigned permission, int argc, char *argv[]) { int min = cmd->min + 1; int max = cmd->max + 1; @@ -1385,7 +1385,7 @@ static int checkArgcAndPermission(CommandEntry * cmd, struct client *client, } static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *client, - int permission, + unsigned permission, int argc, char *argv[]) { diff --git a/src/permission.c b/src/permission.c index 4d53fa0cf..193d21f8a 100644 --- a/src/permission.c +++ b/src/permission.c @@ -34,11 +34,11 @@ static List *permission_passwords; -static int permission_default; +static unsigned permission_default; -static int parsePermissions(char *string) +static unsigned parsePermissions(char *string) { - int permission = 0; + unsigned permission = 0; char *temp; char *tok; @@ -70,7 +70,7 @@ void initPermissions(void) char *temp; char *cp2; char *password; - int *permission; + unsigned *permission; ConfigParam *param; permission_passwords = makeList(free, 1); @@ -99,7 +99,7 @@ void initPermissions(void) password = temp; - permission = xmalloc(sizeof(int)); + permission = xmalloc(sizeof(unsigned)); *permission = parsePermissions(strtok_r(NULL, "", &cp2)); @@ -116,12 +116,12 @@ void initPermissions(void) sortList(permission_passwords); } -int getPermissionFromPassword(char *password, int *permission) +int getPermissionFromPassword(char *password, unsigned *permission) { void *foundPermission; if (findInList(permission_passwords, password, &foundPermission)) { - *permission = *((int *)foundPermission); + *permission = *((unsigned *)foundPermission); return 0; } @@ -133,7 +133,7 @@ void finishPermissions(void) freeList(permission_passwords); } -int getDefaultPermissions(void) +unsigned getDefaultPermissions(void) { return permission_default; } diff --git a/src/permission.h b/src/permission.h index af52ce411..93f85cf7d 100644 --- a/src/permission.h +++ b/src/permission.h @@ -26,11 +26,11 @@ #define PERMISSION_ADMIN 8 -int getPermissionFromPassword(char *password, int *permission); +int getPermissionFromPassword(char *password, unsigned *permission); void finishPermissions(void); -int getDefaultPermissions(void); +unsigned getDefaultPermissions(void); void initPermissions(void); |