Currently the session cookie is created in: $HOME/.aucat_cookie
besides being ugly, this makes libsndio difficult to use with unveil(2). This change is to make libsndio use: $HOME/.sndio/cookie instead. OK? Index: aucat.c =================================================================== RCS file: /cvs/src/lib/libsndio/aucat.c,v retrieving revision 1.71 diff -u -p -u -p -r1.71 aucat.c --- aucat.c 9 Jan 2016 08:27:24 -0000 1.71 +++ aucat.c 26 Jul 2018 21:37:08 -0000 @@ -205,7 +205,8 @@ _aucat_wdata(struct aucat *hdl, const vo static int aucat_mkcookie(unsigned char *cookie) { -#define COOKIE_SUFFIX "/.aucat_cookie" +#define COOKIE_DIR "/.sndio" +#define COOKIE_SUFFIX "/.sndio/cookie" #define TEMPL_SUFFIX ".XXXXXXXX" struct stat sb; char *home, *path = NULL, *tmp = NULL; @@ -264,11 +265,20 @@ bad_gen: /* * try to save the cookie */ + if (home == NULL) goto done; tmp = malloc(path_len + sizeof(TEMPL_SUFFIX)); if (tmp == NULL) goto done; + + /* create ~/.sndio directory */ + memcpy(tmp, home, home_len); + memcpy(tmp + home_len, COOKIE_DIR, sizeof(COOKIE_DIR)); + if (mkdir(tmp, 0755) < 0 && errno != EEXIST) + goto done; + + /* create cookie file in it */ memcpy(tmp, path, path_len); memcpy(tmp + path_len, TEMPL_SUFFIX, sizeof(TEMPL_SUFFIX)); fd = mkstemp(tmp); Index: sio_open.3 =================================================================== RCS file: /cvs/src/lib/libsndio/sio_open.3,v retrieving revision 1.46 diff -u -p -u -p -r1.46 sio_open.3 --- sio_open.3 3 Jan 2017 20:29:28 -0000 1.46 +++ sio_open.3 26 Jul 2018 21:37:09 -0000 @@ -690,7 +690,7 @@ promises. and .Va cpath are needed to read, write or create the authentication cookie -.Pa ~/.aucat_cookie . +.Pa ~/.sndio/cookie . .It .Va rpath , .Va wpath , Index: sndio.7 =================================================================== RCS file: /cvs/src/lib/libsndio/sndio.7,v retrieving revision 1.19 diff -u -p -u -p -r1.19 sndio.7 --- sndio.7 7 Dec 2017 15:43:03 -0000 1.19 +++ sndio.7 26 Jul 2018 21:37:09 -0000 @@ -191,7 +191,7 @@ Users are identified by their which is automatically generated by audio or MIDI applications upon the first connection to the server. The cookie is stored in -.Pa "$HOME/.aucat_cookie" +.Pa "$HOME/.sndio/cookie" and contains 128 bits of raw random data. .Pp If a session needs to be shared between multiple users, they