[squid-users] auth problems

From: Petter Lindqvist <petter@dont-contact.us>
Date: Tue, 24 Apr 2001 09:35:14 +0200 (CEST)

I can get squid to work as I want when not using any auth module.
As I can't find any auth module that works as I want, I wrote an own
according to the instructions I've found. But I'm not sure it works
exactly as it should. It denies bad passwords, but when I've entered a
correct one the connections just hangs, and nothing more happens.

My auth module looks like this and it should let anyone in who has login
permissions on the squid host computer:
(Feel free to include a corrected version of this auth module in coming
releases of squid, just mention my mail adress as author or something.)

#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>

int main()
{
  struct passwd *pw;
  char login[512],pass[512];
  FILE *fh;
  while((scanf("%s%s",login,pass))==2)
    {
      pw=getpwnam(login);
      if(!pw)
        {
          printf("ERR\n");
        }
      else
        {
          if(strcmp(crypt(pass,pw->pw_passwd),pw->pw_passwd))
            {
              printf("ERR\n");
            }
          else
            {
              printf("OK\n");
            }
          fflush(stdout);
        }
    }
  return 0;
}

Config file that works without the auth module above:

http_port 2046
cache_dir ufs /usr/local/squid/cache 100 16 256
cache_access_log /usr/local/squid/logs/access.log
cache_log /usr/local/squid/logs/cache.log
cache_store_log /usr/local/squid/logs/store.log
dns_nameservers none
unlinkd_program /usr/pkg/libexec/unlinkd
pinger_program /usr/pkg/libexec/pinger
acl all src 0.0.0.0/0.0.0.0
no_cache deny all

authenticate_program /usr/local/bin/nis_auth
proxy_auth_realm www.hig.se proxy
acl nis proxy_auth REQUIRED
http_access allow nis
http_access deny all

cache_effective_user nobody
cache_effective_group nogroup
cache_mgr petter@hig.se
Received on Tue Apr 24 2001 - 01:36:56 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:59:34 MST