File: sasl-auth-test.c

package info (click to toggle)
cvm 0.97-0.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,036 kB
  • sloc: ansic: 4,065; sh: 2,758; makefile: 235; sql: 15
file content (36 lines) | stat: -rw-r--r-- 734 bytes parent folder | download
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
32
33
34
35
36
#include <bglibs/iobuf.h>
#include <bglibs/msg.h>
#include <bglibs/str.h>
#include "sasl.h"

const char program[] = "sasl-auth-test";
const int msg_show_pid = 0;

struct sasl_auth sa = {
  .prefix = "+ ",
  .in = &inbuf,
  .out = &outbuf,
};

int main(int argc, char* argv[])
{
  static str s;
  int i;
  int j;
  const char* msg;
  if (argc != 2)
    die3(1, "usage: ", program, " string");
  if (!sasl_auth_init(&sa))
    die1(1, "sasl_auth_init failed");
  if (!sasl_auth_caps(&s))
    die1(1, "sasl_auth_cap failed");
  msg1(s.s);
  str_copys(&s, argv[1]);
  if ((i = sasl_auth1(&sa, &s)) != 0) {
    j = i;
    msg = sasl_auth_msg(&j);
    dief(1, "{sasl_auth1 failed: }d{\n  }d{ }s", i, j, msg);
  }
  return 0;
  (void)argc;
}