aboutsummaryrefslogtreecommitdiff
path: root/libxcb/src/xcb_auth.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-21 22:50:26 +0100
committermarha <marha@users.sourceforge.net>2014-03-21 22:56:24 +0100
commiteb71c0f23999d1cc156e1821d73634ec79621fc2 (patch)
treed45d551ada10b1bfb3d57517c892770734a77817 /libxcb/src/xcb_auth.c
parentab3d257d88f67e169a314ad0fac851fc2fc6cb05 (diff)
parent41fea4472dec859ddec76bdfa7108ebec71de1e3 (diff)
downloadvcxsrv-eb71c0f23999d1cc156e1821d73634ec79621fc2.tar.gz
vcxsrv-eb71c0f23999d1cc156e1821d73634ec79621fc2.tar.bz2
vcxsrv-eb71c0f23999d1cc156e1821d73634ec79621fc2.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver fontconfig libX11 libXext libxcb mesa git update 21 Mar 2014 Conflicts: libxcb/src/xcb_auth.c libxcb/src/xcb_conn.c libxcb/src/xcb_util.c libxcb/src/xcb_windefs.h mesalib/src/mapi/glapi/glapi.h
Diffstat (limited to 'libxcb/src/xcb_auth.c')
-rw-r--r--libxcb/src/xcb_auth.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/libxcb/src/xcb_auth.c b/libxcb/src/xcb_auth.c
index 0514a77e7..de628a6e4 100644
--- a/libxcb/src/xcb_auth.c
+++ b/libxcb/src/xcb_auth.c
@@ -89,11 +89,11 @@ static int authnameslen[N_AUTH_PROTOS] = {
static size_t memdup(char **dst, void *src, size_t len)
{
if(len)
- *dst = malloc(len);
+ *dst = malloc(len);
else
- *dst = 0;
+ *dst = 0;
if(!*dst)
- return 0;
+ return 0;
memcpy(*dst, src, len);
return len;
}
@@ -101,9 +101,9 @@ static size_t memdup(char **dst, void *src, size_t len)
static int authname_match(enum auth_protos kind, char *name, size_t namelen)
{
if(authnameslen[kind] != namelen)
- return 0;
+ return 0;
if(memcmp(authnames[kind], name, namelen))
- return 0;
+ return 0;
return 1;
}
@@ -183,7 +183,7 @@ static void do_append(char *buf, int *idxp, void *val, size_t valsize) {
*idxp += valsize;
}
#endif
-
+
static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *sockname)
{
if (authname_match(AUTH_MC1, authptr->name, authptr->name_length)) {
@@ -195,22 +195,22 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
#ifdef HASXDMAUTH
#define APPEND(buf,idx,val) do_append((buf),&(idx),&(val),sizeof(val))
if (authname_match(AUTH_XA1, authptr->name, authptr->name_length)) {
- int j;
+ int j;
- info->data = malloc(192 / 8);
- if(!info->data)
- return 0;
+ info->data = malloc(192 / 8);
+ if(!info->data)
+ return 0;
- for (j = 0; j < 8; j++)
- info->data[j] = authptr->data[j];
- switch(sockname->sa_family) {
+ for (j = 0; j < 8; j++)
+ info->data[j] = authptr->data[j];
+ switch(sockname->sa_family) {
case AF_INET:
/*block*/ {
- struct sockaddr_in *si = (struct sockaddr_in *) sockname;
- APPEND(info->data, j, si->sin_addr.s_addr);
- APPEND(info->data, j, si->sin_port);
- }
- break;
+ struct sockaddr_in *si = (struct sockaddr_in *) sockname;
+ APPEND(info->data, j, si->sin_addr.s_addr);
+ APPEND(info->data, j, si->sin_port);
+ }
+ break;
#ifdef AF_INET6
case AF_INET6:
/*block*/ {
@@ -235,26 +235,26 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
#endif
case AF_UNIX:
/*block*/ {
- uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
- uint16_t fakeport = htons(getpid());
- APPEND(info->data, j, fakeaddr);
- APPEND(info->data, j, fakeport);
- }
- break;
+ uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
+ uint16_t fakeport = htons(getpid());
+ APPEND(info->data, j, fakeaddr);
+ APPEND(info->data, j, fakeport);
+ }
+ break;
default:
free(info->data);
return 0; /* do not know how to build this */
- }
- {
- uint32_t now = htonl(time(0));
- APPEND(info->data, j, now);
- }
- assert(j <= 192 / 8);
- while (j < 192 / 8)
- info->data[j++] = 0;
- info->datalen = j;
- XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen);
- return 1;
+ }
+ {
+ uint32_t now = htonl(time(0));
+ APPEND(info->data, j, now);
+ }
+ assert(j <= 192 / 8);
+ while (j < 192 / 8)
+ info->data[j++] = 0;
+ info->datalen = j;
+ XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen);
+ return 1;
}
#undef APPEND
#endif
@@ -273,7 +273,7 @@ typedef int (*LPFN_GETPEERNAME)(int,struct sockaddr *,socklen_t *);
(according to POSIX, applications should not assume a particular
length for `sockaddr_un.sun_path') */
static struct sockaddr *get_peer_sock_name(LPFN_GETPEERNAME socket_func,
- int fd)
+ int fd)
{
socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK;
socklen_t actual_socknamelen = socknamelen;