#include <stdio.h>

#define CONFFILE "/etc/pam_smb.conf"

/***********************************************************************
	This file is (C) Dave Airlie 1997 ( David.Airlie@ul.ie ) 
	and is covered by the GPL provided in the COPYING FILE.
***********************************************************************/

int smb_readpamconf(char *smb_servers, char *smb_domain)
{
	FILE *fl;
	char tmp[50];
	int len;

	if (!(fl=fopen(CONFFILE,"r")))
	{
		return 1;
	}
	
	fgets(smb_domain, 50, fl); 
	len=strlen(smb_domain);
	smb_domain[len-1]='\0';

	
	smb_servers[0] = 0;

	do
	{
		fgets(tmp, 50, fl);
		len=strlen(tmp);
		tmp[len-1]='\0';

		if (len == 0) break;

		if (smb_servers[0] != 0)
		{
			strcat(smb_servers, " ");
		}
	
		strcat(smb_servers, tmp);

	} while (!feof(fl));
	
	fclose(fl);
	return(0);
}

