summaryrefslogtreecommitdiff
path: root/lib/libsndio
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2018-07-28 09:11:56 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2018-07-28 09:11:56 +0000
commitd9ce75352fb48bb12143d4fca35f64ee385c564c (patch)
treeb87c4a950316deb3110e902062c0cd4f848efa40 /lib/libsndio
parent759d7f59363d134a200dd709b291a59209571b2c (diff)
Move libsndio session cookie in its own $HOME/.sndio/ directory to
make libsndio easier to use with unveil(2). "make sense" deraadt
Diffstat (limited to 'lib/libsndio')
-rw-r--r--lib/libsndio/aucat.c14
-rw-r--r--lib/libsndio/sio_open.36
-rw-r--r--lib/libsndio/sndio.76
3 files changed, 18 insertions, 8 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index 600216db984..f2d9cd559b9 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -205,7 +205,8 @@ _aucat_wdata(struct aucat *hdl, const void *buf, size_t len,
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);
diff --git a/lib/libsndio/sio_open.3 b/lib/libsndio/sio_open.3
index f3fc59c7cc8..fc5b68edba0 100644
--- a/lib/libsndio/sio_open.3
+++ b/lib/libsndio/sio_open.3
@@ -1,4 +1,4 @@
-.\" $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>
.\"
@@ -14,7 +14,7 @@
.\" 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
@@ -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 ,
diff --git a/lib/libsndio/sndio.7 b/lib/libsndio/sndio.7
index 264777d24cd..afbfde0e94c 100644
--- a/lib/libsndio/sndio.7
+++ b/lib/libsndio/sndio.7
@@ -1,4 +1,4 @@
-.\" $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>
.\"
@@ -14,7 +14,7 @@
.\" 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
@@ -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