Skip to content

Commit

Permalink
disallow empty socket names
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@natty32 committed Apr 5, 2011
1 parent 667d674 commit 703cad6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions socket.c
Expand Up @@ -317,6 +317,26 @@ char *generate_socket_name(char *socket_name) {

char *new_socket;
char *tcp_port;
int i;
char *ptr = socket_name;

// ltrim spaces

for(i=0;i<(int)strlen(socket_name);i++) {
if (isspace(socket_name[i])) {
ptr++;
}
else {
break;
}
}

socket_name = ptr;

if (socket_name[0] == 0) {
uwsgi_log("invalid/empty uwsgi socket name\n");
exit(1);
}

tcp_port = strchr(socket_name, ':');
if (!tcp_port) return socket_name;
Expand Down
2 changes: 1 addition & 1 deletion spooler.c
Expand Up @@ -250,7 +250,7 @@ int uwsgi_request_spooler(struct wsgi_request *wsgi_req) {
if (unlink(spool_filename)) {
uwsgi_error("unlink()");
uwsgi_log("something horrible happened !!! check your spooler ASAP !!!\n");
goodbye_cruel_world();
exit(1);
}
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion utils.c
Expand Up @@ -268,7 +268,7 @@ void uwsgi_as_root() {
#endif

if (!getuid()) {
if (!uwsgi.master_as_root) {
if (!uwsgi.master_as_root && !uwsgi.uidname) {
uwsgi_log("uWSGI running as root, you can use --uid/--gid/--chroot options\n");
}

Expand Down

0 comments on commit 703cad6

Please sign in to comment.