Lines Matching defs:auth
70 Xauth *auth;
160 " data hexkey auth protocol specific data needed to generate the entry\n"
414 Xauth *auth;
416 auth = malloc (sizeof (Xauth));
417 if (!auth) goto bad;
418 auth->family = 0;
419 auth->address = NULL;
420 auth->address_length = 0;
421 auth->number = NULL;
422 auth->number_length = 0;
423 auth->name = NULL;
424 auth->name_length = 0;
425 auth->data = NULL;
426 auth->data_length = 0;
428 if (!get_short (fp, (unsigned short *) &auth->family))
430 if (!get_short (fp, (unsigned short *) &auth->address_length))
432 if (!get_bytes (fp, (unsigned int) auth->address_length, &auth->address))
434 if (!get_short (fp, (unsigned short *) &auth->number_length))
436 if (!get_bytes (fp, (unsigned int) auth->number_length, &auth->number))
438 if (!get_short (fp, (unsigned short *) &auth->name_length))
440 if (!get_bytes (fp, (unsigned int) auth->name_length, &auth->name))
442 if (!get_short (fp, (unsigned short *) &auth->data_length))
444 if (!get_bytes (fp, (unsigned int) auth->data_length, &auth->data))
450 return auth;
454 if (auth) XauDisposeAuth (auth); /* won't free null pointers */
464 Xauth *auth;
471 while ((auth = ((*readfunc) (fp))) != NULL) {
475 "%s: unable to alloc entry reading auth file\n",
480 l->auth = auth;
530 Xauth *auth = malloc(sizeof(Xauth));
532 if ((newal == NULL) || (auth == NULL)) {
534 if (auth != NULL) free(auth);
546 newal->auth = auth;
548 auth->family = addrlist_cur->family;
549 auth->address = addrlist_cur->address;
550 auth->address_length = addrlist_cur->len;
551 auth->number = copystring(buf, dpylen);
552 auth->number_length = dpylen;
553 auth->name = NULL;
554 auth->name_length = 0;
555 auth->data = NULL;
556 auth->data_length = 0;
648 static AuthList *xauth_head = NULL; /* list of auth entries */
651 static Bool xauth_allowed = True; /* if allowed to write auth file */
807 "%s: unable to read auth entries from file \"%s\"\n",
858 if (list->auth->name_length == 18
859 && strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) == 0) {
860 if (!XauWriteAuth(fp, list->auth)) {
867 if (list->auth->name_length != 18
868 || strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) != 0) {
869 if (!XauWriteAuth(fp, list->auth)) {
990 dump_numeric(register FILE *fp, register Xauth *auth)
992 fprintf (fp, "%04x", auth->family); /* unsigned short */
993 fprintf (fp, " %04x ", auth->address_length); /* short */
994 fprintfhex (fp, auth->address_length, auth->address);
995 fprintf (fp, " %04x ", auth->number_length); /* short */
996 fprintfhex (fp, auth->number_length, auth->number);
997 fprintf (fp, " %04x ", auth->name_length); /* short */
998 fprintfhex (fp, auth->name_length, auth->name);
999 fprintf (fp, " %04x ", auth->data_length); /* short */
1000 fprintfhex (fp, auth->data_length, auth->data);
1007 dump_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
1013 dump_numeric (fp, auth);
1017 switch (auth->family) {
1019 fwrite (auth->address, sizeof (char), auth->address_length, fp);
1027 dpyname = get_hostname (auth);
1034 fprintf (fp, "#%04x#", auth->family);
1035 fprintfhex (fp, auth->address_length, auth->address);
1039 fwrite (auth->number, sizeof (char), auth->number_length, fp);
1042 fwrite (auth->name, sizeof (char), auth->name_length, fp);
1045 if (!strncmp(auth->name, SECURERPC, auth->name_length) ||
1046 !strncmp(auth->name, K5AUTH, auth->name_length))
1047 fwrite (auth->data, sizeof (char), auth->data_length, fp);
1049 fprintfhex (fp, auth->data_length, auth->data);
1056 extract_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
1073 (*(ed->numeric ? dump_numeric : XauWriteAuth)) (ed->fp, auth);
1163 if (eq_auth_dpy_and_name (a->auth, b->auth)) { /* found a duplicate */
1169 XauDisposeAuth (b->auth);
1197 /* Insert sort, in each pass it removes auth records of certain */
1224 SORT_OUT(iter->auth->family != FamilyWild && iter->auth->number_length != 0);
1225 SORT_OUT(iter->auth->family != FamilyWild && iter->auth->number_length == 0);
1226 SORT_OUT(iter->auth->family == FamilyWild && iter->auth->number_length != 0);
1227 SORT_OUT(iter->auth->family == FamilyWild && iter->auth->number_length == 0);
1233 copyAuth(Xauth *auth)
1242 a->family = auth->family;
1243 if (auth->address_length != 0) {
1244 a->address = malloc(auth->address_length);
1249 memcpy(a->address, auth->address, auth->address_length);
1250 a->address_length = auth->address_length;
1252 if (auth->number_length != 0) {
1253 a->number = malloc(auth->number_length);
1259 memcpy(a->number, auth->number, auth->number_length);
1260 a->number_length = auth->number_length;
1262 if (auth->name_length != 0) {
1263 a->name = malloc(auth->name_length);
1270 memcpy(a->name, auth->name, auth->name_length);
1271 a->name_length = auth->name_length;
1273 if (auth->data_length != 0) {
1274 a->data = malloc(auth->data_length);
1282 memcpy(a->data, auth->data, auth->data_length);
1283 a->data_length = auth->data_length;
1319 tmp_auth = copyAuth(l->auth);
1321 if (match_auth_dpy (proto->auth, tmp_auth)) {
1334 l->auth, data);
1341 if (proto->auth->address) free (proto->auth->address);
1342 if (proto->auth->number) free (proto->auth->number);
1343 free (proto->auth);
1357 remove_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
1364 * unlink the auth we were asked to
1366 while (!eq_auth((list = *listp)->auth, auth)) {
1372 XauDisposeAuth (list->auth); /* free the auth */
1497 dump_entry (inputfilename, lineno, l->auth, (char *) &ld);
1684 Xauth *auth = list_cur->auth;
1686 auth->name_length = strlen (protoname);
1687 auth->name = copystring (protoname, auth->name_length);
1688 if (!auth->name) {
1691 auth->name_length);
1694 XauDisposeAuth(list_cur->auth);
1700 auth->data_length = len;
1701 auth->data = malloc(len);
1702 if (!auth->data) {
1707 XauDisposeAuth(list_cur->auth);
1713 memcpy(auth->data, key, len);