File: t_utils.h

package info (click to toggle)
gssproxy 0.9.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,516 kB
  • sloc: ansic: 19,391; python: 1,196; xml: 611; makefile: 458; sh: 200
file content (31 lines) | stat: -rw-r--r-- 911 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Copyright (C) 2014 the GSS-PROXY contributors, see COPYING for license */

#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gssapi/gssapi.h>
#include <gssapi/gssapi_krb5.h>
#include <gssapi/gssapi_ext.h>

#define STDIN_FD 0
#define STDOUT_FD 1
#define MAX_RPC_SIZE 1024*1024

#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))

#define DEBUG(...) do { \
    char _msg[4096]; \
    int _snret; \
    _snret = snprintf(_msg, 4096, __VA_ARGS__); \
    fprintf(stderr, "%s[%s:%d]: %s", argv[0], __FUNCTION__, __LINE__, _msg); \
    if (_snret >= 4096) fprintf(stderr, " [TRUNCATED]\n"); \
    fflush(stderr); \
} while(0);

int t_send_buffer(int fd, char *buf, uint32_t len);
int t_recv_buffer(int fd, char *buf, uint32_t *len);

void t_log_failure(gss_OID mech, uint32_t maj, uint32_t min);

int t_string_to_name(const char *string, gss_name_t *name, gss_OID type);