make libsndio easier to use with unveil(2).
"make sense" deraadt
-/* $OpenBSD: aucat.c,v 1.71 2016/01/09 08:27:24 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.72 2018/07/28 09:11:55 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
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;
/*
* 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);
-.\" $OpenBSD: sio_open.3,v 1.46 2017/01/03 20:29:28 natano Exp $
+.\" $OpenBSD: sio_open.3,v 1.47 2018/07/28 09:11:55 ratchov Exp $
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 3 2017 $
+.Dd $Mdocdate: July 28 2018 $
.Dt SIO_OPEN 3
.Os
.Sh NAME
and
.Va cpath
are needed to read, write or create the authentication cookie
-.Pa ~/.aucat_cookie .
+.Pa ~/.sndio/cookie .
.It
.Va rpath ,
.Va wpath ,
-.\" $OpenBSD: sndio.7,v 1.19 2017/12/07 15:43:03 schwarze Exp $
+.\" $OpenBSD: sndio.7,v 1.20 2018/07/28 09:11:55 ratchov Exp $
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 7 2017 $
+.Dd $Mdocdate: July 28 2018 $
.Dt SNDIO 7
.Os
.Sh NAME
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