-
- if (rc = gsscon_authorize(*gssctx, &auth, &autherr)) {
- fprintf(stderr, "tids_auth_connection: Error from gsscon_authorize, rc = %d, autherr = %d.\n",
- rc, autherr);
- return -1;
- }
-
- if (auth)
- fprintf(stdout, "tids_auth_connection: Connection authenticated, conn = %d.\n", conn);
- else
- fprintf(stderr, "tids_auth_connection: Authentication failed, conn %d.\n", conn);
-
- return !auth;
-}
-
-static int tids_read_request (TIDS_INSTANCE *tids, int conn, gss_ctx_id_t *gssctx, TR_MSG **mreq)
-{
- int err;
- char *buf;
- size_t buflen = 0;
-
- if (err = gsscon_read_encrypted_token(conn, *gssctx, &buf, &buflen)) {
- if (buf)
- free(buf);
- return -1;
- }
-
- fprintf(stdout, "tids_read_request():Request Received, %u bytes.\n", (unsigned) buflen);
-
- /* Parse request */
- if (NULL == ((*mreq) = tr_msg_decode(buf, buflen))) {
- fprintf(stderr, "tids_read_request():Error decoding request.\n");
- free (buf);
- return -1;
- }
-
- /* If this isn't a TID Request, just drop it. */
- if (TID_REQUEST != (*mreq)->msg_type) {
- fprintf(stderr, "tids_read_request(): Not a TID Request, dropped.\n");
- return -1;
- }
-
- free (buf);
- return buflen;