Search squid archive

Question about authenticateNegotiateHandleReply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx";
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");
}




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux