/* Useful macros for the command functions: */
#define haveargs(n) do { if(argc < n) { sq(sk, 0, L"501", L"Wrong number of arguments", NULL); return; } } while(0)
-#define havepriv(p) do { if((data->userinfo == NULL) || ((data->userinfo->perms & (p)) != (p))) { sq(sk, 0, L"502", L"Unauthorized request", L"needed", L"%x", (p), L"had", L"%x", data->userinfo->perms, NULL); return; } } while(0)
+#define havepriv(p) do { if((data->userinfo == NULL) || ((data->userinfo->perms & (p)) != (p))) { sq(sk, 0, L"502", L"Unauthorized request", L"needed", L"%x", (p), NULL); return; } } while(0)
static void cmd_connect(struct socket *sk, struct uidata *data, int argc, wchar_t **argv)
{
notif->argv[ca].d.n = va_arg(args, int);
break;
case NOTIF_STR:
- notif->argv[ca].d.s = wcsdup(va_arg(args, wchar_t *));
+ notif->argv[ca].d.s = swcsdup(va_arg(args, wchar_t *));
break;
case NOTIF_FLOAT:
notif->argv[ca].d.d = va_arg(args, double);
{
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);
struct sockaddr_un *un;
struct passwd *pwd;
wchar_t *wcsname;
+ mode_t ou;
if(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);