/*
- * Copyright (c) 2011, JANET(UK)
+ * Copyright (c) 2012, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*/
#include <gsscon.h>
+#include <assert.h>
+static int cb_print_names(gss_name_t clientName,
+ gss_buffer_t displayName,
+ void *data)
+{
+ assert(clientName != NULL);
+ assert(data == NULL);
+ printf("Gss name: %-*s\n",
+ displayName->length, displayName->value);
+ return 0;
+}
+
+
/* --------------------------------------------------------------------------- */
static int SetupListeningSocket (int inPort,
int listenFD = -1;
gss_ctx_id_t gssContext = GSS_C_NO_CONTEXT;
int i = 0;
-
+ gss_buffer_desc nameBuffer = {0, "trustidentity"};
+
for (i = 1; (i < argc) && !err; i++) {
if ((strcmp (argv[i], "--port") == 0) && (i < (argc - 1))) {
port = strtol (argv[++i], NULL, 0);
int authorizationError = 0;
connectionFD = accept (listenFD, NULL, NULL);
+
if (connectionFD < 0) {
if (errno != EINTR) {
err = errno;
}
printf ("Accepting new connection...\n");
- connectionErr = gsscon_passive_authenticate (connectionFD, &gssContext);
+ connectionErr = gsscon_passive_authenticate (connectionFD, nameBuffer, &gssContext,
+ cb_print_names, NULL);
if (!connectionErr) {
connectionErr = gsscon_authorize (gssContext,