Back to index

courier  0.68.2
Functions
pop3dcapa.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <ctype.h>
#include <fcntl.h>

Go to the source code of this file.

Functions

const char * externalauth ()
int have_starttls ()
int tls_required ()
const char * pop3_externalauth ()
void pop3dcapa ()

Function Documentation

const char* externalauth ( )

Definition at line 16 of file externalauth.c.

{
       const char *p=getenv("TLS_EXTERNAL");
       char *q, *r;

       if (!p || !*p)
              return NULL;

       if ((q=malloc(strlen(p)+20)) == NULL)
              return NULL;

       strcat(strcpy(q, "TLS_SUBJECT_"), p);

       for (r=q; *r; r++)
              if (*r >= 'a' && *r <= 'z')
                     *r -= 'a' - 'A';

       p=getenv(q);
       free(q);

       if (p && *p)
              return p;
       return 0;
}
int have_starttls ( )

Definition at line 24 of file pop3dcapa.c.

{
       const char *p;

        if ((p=getenv("POP3_STARTTLS")) == 0)   return (0);
        if (*p != 'y' && *p != 'Y')             return (0);

        p=getenv("COURIERTLS");
        if (!p || !*p)  return (0);
        if (access(p, X_OK))    return (0);
        return (1);
}
const char* pop3_externalauth ( )

Definition at line 46 of file pop3dcapa.c.

{
       const char *external=NULL;
       const char *p;

       if ((p=getenv("POP3_TLS")) != 0 && atoi(p))
              external=externalauth();

       return external;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pop3dcapa ( )

Definition at line 57 of file pop3dcapa.c.

{
       const char *p;
       const char *external=pop3_externalauth();

       printf("+OK Here's what I can do:\r\n");

       if ((p=getenv("POP3_TLS")) != 0 && atoi(p) &&
           (p=getenv("POP3AUTH_TLS")) != 0 && *p)
              ;
       else
              p=getenv("POP3AUTH");

       if ((p && *p) || external)
       {
              if (!p)
                     p="";

              if (!external)
                     external="";

              printf("SASL %s%s%s\r\n", p, *p && *external ? " ":"",
                     *external ? "EXTERNAL":"");
       }
              
       if (have_starttls())
              printf("STLS\r\n");

       printf("TOP\r\nUSER\r\nLOGIN-DELAY 10\r\nPIPELINING\r\nUIDL\r\nIMPLEMENTATION Courier Mail Server\r\n.\r\n");
       fflush(stdout);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int tls_required ( )

Definition at line 38 of file pop3dcapa.c.

{
       const char *p=getenv("POP3_TLS_REQUIRED");

        if (p && atoi(p))       return (1);
        return (0);
}

Here is the caller graph for this function: