X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=daemon%2Fui.c;h=21f387e0a2a25ee361eb092d430c21f3e139d89f;hb=68f4d42909fb311bc173dc2f684cd826b1f89ba5;hp=8e9b64345d501ff606631df5605405dbd4bbc27f;hpb=2af7e5b059fda7d6db85b8ad0abb3f0ef332147c;p=doldaconnect.git diff --git a/daemon/ui.c b/daemon/ui.c index 8e9b643..21f387e 100644 --- a/daemon/ui.c +++ b/daemon/ui.c @@ -1,6 +1,6 @@ /* * Dolda Connect - Modular multiuser Direct Connect-style client - * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com) + * Copyright (C) 2004 Fredrik Tolf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1548,6 +1548,7 @@ static void freeuidata(struct uidata *data) actives = data->next; data->sk->readcb = NULL; data->sk->errcb = NULL; + closesock(data->sk); putsock(data->sk); while((qcmd = unlinkqcmd(data)) != NULL) freequeuecmd(qcmd); @@ -2234,13 +2235,17 @@ static int unixsockupdate(struct configvar *var, void *uudata) { struct socket *newsock; struct sockaddr_un *un; + mode_t ou; newsock = NULL; + ou = umask(0111); if(((un = makeunixname()) != NULL) && ((newsock = netcslistenlocal(SOCK_STREAM, (struct sockaddr *)un, sizeof(*un), uiaccept, NULL)) == NULL)) { + umask(ou); flog(LOG_WARNING, "could not create new Unix UI socket, reverting to old: %s", strerror(errno)); return(0); } + umask(ou); if(unixsocket != NULL) { putsock(unixsocket); @@ -2256,6 +2261,7 @@ static int init(int hup) struct sockaddr_un *un; struct passwd *pwd; wchar_t *wcsname; + mode_t ou; if(hup) { @@ -2275,11 +2281,14 @@ static int init(int hup) return(1); } CBREG(confgetvar("ui", "port"), conf_update, tcpportupdate, NULL, NULL); + ou = umask(0111); if(((un = makeunixname()) != NULL) && ((unixsocket = netcslistenlocal(SOCK_STREAM, (struct sockaddr *)un, sizeof(*un), uiaccept, NULL)) == NULL)) { + umask(ou); flog(LOG_CRIT, "could not create Unix UI socket: %s", strerror(errno)); return(1); } + umask(ou); CBREG(confgetvar("ui", "unixsock"), conf_update, unixsockupdate, NULL, NULL); GCBREG(newfncb, newfnetnode, NULL); GCBREG(newtransfercb, newtransfernotify, NULL);