Merge branch 'master' into mixer

This commit is contained in:
Alexandre Ratchov 2018-07-27 16:30:57 +02:00
commit 6d55c0b59f
3 changed files with 15 additions and 5 deletions

View File

@ -24,11 +24,11 @@
* *
* DIR [ '-' UID ] '/' FILE UNIT * DIR [ '-' UID ] '/' FILE UNIT
* *
* example: "/tmp/aucat-1000/aucat0" * example: "/tmp/sndio-1000/sock0"
* *
*/ */
#define SOCKPATH_DIR "/tmp/aucat" #define SOCKPATH_DIR "/tmp/sndio"
#define SOCKPATH_FILE "aucat" #define SOCKPATH_FILE "sock"
#define SOCKPATH_MAX (1 + \ #define SOCKPATH_MAX (1 + \
sizeof(SOCKPATH_DIR) - 1 + \ sizeof(SOCKPATH_DIR) - 1 + \
sizeof(char) + \ sizeof(char) + \

View File

@ -244,7 +244,8 @@ _aucat_wdata(struct aucat *hdl, const void *buf, size_t len,
static int static int
aucat_mkcookie(unsigned char *cookie) aucat_mkcookie(unsigned char *cookie)
{ {
#define COOKIE_SUFFIX "/.aucat_cookie" #define COOKIE_DIR "/.sndio"
#define COOKIE_SUFFIX "/.sndio/cookie"
#define TEMPL_SUFFIX ".XXXXXXXX" #define TEMPL_SUFFIX ".XXXXXXXX"
struct stat sb; struct stat sb;
char *home, *path = NULL, *tmp = NULL; char *home, *path = NULL, *tmp = NULL;
@ -311,11 +312,20 @@ bad_gen:
/* /*
* try to save the cookie * try to save the cookie
*/ */
if (home == NULL) if (home == NULL)
goto done; goto done;
tmp = malloc(path_len + sizeof(TEMPL_SUFFIX)); tmp = malloc(path_len + sizeof(TEMPL_SUFFIX));
if (tmp == NULL) if (tmp == NULL)
goto done; 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, path_len);
memcpy(tmp + path_len, TEMPL_SUFFIX, sizeof(TEMPL_SUFFIX)); memcpy(tmp + path_len, TEMPL_SUFFIX, sizeof(TEMPL_SUFFIX));
fd = mkstemp(tmp); fd = mkstemp(tmp);

View File

@ -191,7 +191,7 @@ Users are identified by their
which is automatically generated by audio or MIDI applications which is automatically generated by audio or MIDI applications
upon the first connection to the server. upon the first connection to the server.
The cookie is stored in The cookie is stored in
.Pa "$HOME/.aucat_cookie" .Pa "$HOME/.sndio/cookie"
and contains 128 bits of raw random data. and contains 128 bits of raw random data.
.Pp .Pp
If a session needs to be shared between multiple users, they If a session needs to be shared between multiple users, they