[squid-users] Question about authenticateNegotiateHandleReply

From: Markus Moeller <huaraz@dont-contact.us>
Date: Mon, 7 May 2007 20:00:57 +0100

I am trying to write my own authentication helper for the Negotiate
authentication. I get as far as returning "AF blob username" back to squid
but then authenticateNegotiateHandleReply crashes. I looked at the source
and wondering how it should work and wrote a small test program emulating
the authenticateNegotiateHandleReply fucntion and it crashes at if (arg)
*arg++ = '\0';

How should the return value be formatted to make it work ??

Thank you
Markus

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

int main(int argc, char** argv){
char* reply="AF blob markus-a@WINDOWS2003.HOME";
char *blob, *arg;

    blob = strchr(reply, ' ');

    if (blob) {
        blob++;
        arg = strchr(blob + 1, ' ');
    } else {
        arg = NULL;
    }
    if (strncasecmp(reply, "TT ", 3) == 0) {
        /* we have been given a blob to send to the client */
        if (arg)
            *arg++ = '\0';
        printf("TT OK\n");
    } else if (strncasecmp(reply, "AF ", 3) == 0 && arg != NULL) {
        /* we're finished, release the helper */
        if (arg)
            *arg++ = '\0';
        printf("AF OK\n");
    } else if (strncasecmp(reply, "NA ", 3) == 0 && arg != NULL) {
        if (arg)
            *arg++ = '\0';
        printf("NA OK\n");
    } else if (strncasecmp(reply, "BH ", 3) == 0) {
        printf("BH OK\n");
    } else {
        printf("ERROR Unsupported\n");
    }
    printf("reply: %s arg: %s\n",reply?reply:"NULL",arg?arg:"NULL");
}
Received on Mon May 07 2007 - 13:05:36 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:04 MDT