{
static BOOL initialised=False;
static fstring last_from,last_to;
- FILE *f;
+ XFILE *f;
char *mapfile = lp_username_map();
char *s;
pstring buf;
return True;
}
- f = sys_fopen(mapfile,"r");
+ f = x_fopen(mapfile,O_RDONLY, 0);
if (!f) {
DEBUG(0,("can't open username map %s. Error %s\n",mapfile, strerror(errno) ));
return False;
fstrcpy(last_to,user);
if(return_if_mapped) {
lp_list_free (&dosuserlist);
- fclose(f);
+ x_fclose(f);
return True;
}
}
lp_list_free (&dosuserlist);
}
- fclose(f);
+ x_fclose(f);
/*
* Setup the last_from and last_to as an optimization so
Blanks at the start or end of a line are stripped.
The string will be allocated if s2 is NULL
****************************************************************************/
-char *fgets_slash(char *s2,int maxlen,FILE *f)
+char *fgets_slash(char *s2,int maxlen,XFILE *f)
{
char *s=s2;
int len = 0;
int c;
BOOL start_of_line = True;
- if (feof(f))
+ if (x_feof(f))
return(NULL);
if (maxlen <2) return(NULL);
while (len < maxlen-1)
{
- c = getc(f);
+ c = x_getc(f);
switch (c)
{
case '\r':
Start parsing the lmhosts file.
*********************************************************/
-FILE *startlmhosts(char *fname)
+XFILE *startlmhosts(char *fname)
{
- FILE *fp = sys_fopen(fname,"r");
- if (!fp) {
- DEBUG(4,("startlmhosts: Can't open lmhosts file %s. Error was %s\n",
- fname, strerror(errno)));
- return NULL;
- }
- return fp;
+ XFILE *fp = x_fopen(fname,O_RDONLY, 0);
+ if (!fp) {
+ DEBUG(4,("startlmhosts: Can't open lmhosts file %s. Error was %s\n",
+ fname, strerror(errno)));
+ return NULL;
+ }
+ return fp;
}
/********************************************************
Parse the next line in the lmhosts file.
*********************************************************/
-BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr)
+BOOL getlmhostsent( XFILE *fp, pstring name, int *name_type, struct in_addr *ipaddr)
{
pstring line;
- while(!feof(fp) && !ferror(fp)) {
+ while(!x_feof(fp) && !x_ferror(fp)) {
pstring ip,flags,extra;
char *ptr;
int count = 0;
Finish parsing the lmhosts file.
*********************************************************/
-void endlmhosts(FILE *fp)
+void endlmhosts(XFILE *fp)
{
- fclose(fp);
+ x_fclose(fp);
}
BOOL name_register_wins(const char *name, int name_type)
* "lmhosts" means parse the local lmhosts file.
*/
- FILE *fp;
+ XFILE *fp;
pstring lmhost_name;
int name_type2;
struct in_addr return_ip;
pstring name;
int name_type;
struct in_addr ipaddr;
- FILE *fp = startlmhosts( fname );
+ XFILE *fp = startlmhosts( fname );
if (!fp) {
DEBUG(2,("load_lmhosts_file: Can't open lmhosts file %s. Error was %s\n",
**********************************************************************/
static void complete_sync(struct sync_record *s)
{
- FILE *f;
+ XFILE *f;
fstring server, type_str;
unsigned type;
pstring comment;
char *ptr;
int count=0;
- f = sys_fopen(s->fname,"r");
+ f = x_fopen(s->fname,O_RDONLY, 0);
if (!f) return;
- while (!feof(f)) {
+ while (!x_feof(f)) {
if (!fgets_slash(line,sizeof(pstring),f)) continue;
count++;
}
- fclose(f);
+ x_fclose(f);
unlink(s->fname);
BOOL initialise_wins(void)
{
time_t time_now = time(NULL);
- FILE *fp;
+ XFILE *fp;
pstring line;
if(!lp_we_are_a_wins_server())
add_samba_names_to_subnet(wins_server_subnet);
- if((fp = sys_fopen(lock_path(WINS_LIST),"r")) == NULL)
+ if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY, 0)) == NULL)
{
DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
WINS_LIST, strerror(errno) ));
return True;
}
- while (!feof(fp))
+ while (!x_feof(fp))
{
pstring name_str, ip_str, ttl_str, nb_flags_str;
unsigned int num_ips;
version != WINS_VERSION ||
hash != wins_hash()) {
DEBUG(0,("Discarding invalid wins.dat file [%s]\n",line));
- fclose(fp);
+ x_fclose(fp);
return True;
}
continue;
free((char *)ip_list);
}
- fclose(fp);
+ x_fclose(fp);
return True;
}
/* The following definitions come from nsswitch/winbindd.c */
-void winbindd_dump_status(void);
int main(int argc, char **argv);
/* The following definitions come from nsswitch/winbindd_cache.c */
void winbindd_idmap_dump_status(void);
/* The following definitions come from nsswitch/winbindd_misc.c */
-
-BOOL _get_trust_account_password(char *domain, unsigned char *ret_pwd,
- time_t *pass_last_set_time);
enum winbindd_result winbindd_check_machine_acct(
struct winbindd_cli_state *state);
enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state
void debug_conn_state(void);
BOOL domain_handles_open(struct winbindd_domain *domain);
-void winbindd_kill_connections(struct winbindd_domain *domain);
void winbindd_kill_all_connections(void);
void establish_connections(BOOL force_reestablish) ;
BOOL lookup_domain_sid(char *domain_name, struct winbindd_domain *domain);
uint32 *start_ndx, uint16 info_level,
uint32 *num_entries, SAM_DISPINFO_CTR *ctr);
BOOL check_domain_env(char *domain_env, char *domain);
-void parse_domain_user(char *domuser, fstring domain, fstring user);
#endif /* _PROTO_H_ */
static void ScanQconfig_fn(char *psz,void (*fn)(char *, char *))
{
int iEtat;
- FILE *pfile;
+ XFILE *pfile;
char *line,*p;
pstring name,comment;
line = NULL;
*name = 0;
*comment = 0;
- if ((pfile = sys_fopen(psz, "r")) == NULL)
+ if ((pfile = x_fopen(psz, O_RDONLY, 0)) == NULL)
{
DEBUG(0,( "Unable to open qconfig file %s for read!\n", psz));
return;
break;
}
}
- fclose(pfile);
+ x_fclose(pfile);
}
/* Scan qconfig file and locate de printername */
static BOOL ScanQconfig(char *psz,char *pszPrintername)
{
int iLg,iEtat;
- FILE *pfile;
+ XFILE *pfile;
char *pName;
char *line;
DEBUG(0,(" Unable to allocate memory for printer %s\n",pszPrintername));
return(False);
}
- if ((pfile = sys_fopen(psz, "r")) == NULL)
+ if ((pfile = x_fopen(psz, O_RDONLY, 0)) == NULL)
{
DEBUG(0,( "Unable to open qconfig file %s for read!\n", psz));
free(pName);
}
}
free (pName);
- fclose(pfile);
+ x_fclose(pfile);
return(False);
}
#endif /* AIX */
char *line=NULL;
char *psz;
char *p,*q;
- FILE *pfile;
+ XFILE *pfile;
if (pszPrintername == NULL || pszPrintername[0] == '\0')
{
return(ScanQconfig(psz,pszPrintername));
#endif
- if ((pfile = sys_fopen(psz, "r")) == NULL)
+ if ((pfile = x_fopen(psz, O_RDONLY, 0)) == NULL)
{
DEBUG(0,( "Unable to open printcap file %s for read!\n", psz));
return(False);
/* normalise the case */
pstrcpy(pszPrintername,p);
free(line);
- fclose(pfile);
+ x_fclose(pfile);
return(True);
}
p = q;
}
}
- fclose(pfile);
+ x_fclose(pfile);
return(False);
}
char *line;
char *psz;
char *p,*q;
- FILE *pfile;
+ XFILE *pfile;
/* only go looking if no printcap name supplied */
if (((psz = lp_printcapname()) == NULL) || (psz[0] == '\0'))
}
#endif
- if ((pfile = sys_fopen(psz, "r")) == NULL)
+ if ((pfile = x_fopen(psz, O_RDONLY, 0)) == NULL)
{
DEBUG(0,( "Unable to open printcap file %s for read!\n", psz));
return;
if (*name)
fn(name,comment);
}
- fclose(pfile);
+ x_fclose(pfile);
}
if (!smbw_getshared("USER")) {
printf("Username: ");
- u = fgets_slash(line, sizeof(line)-1, stdin);
+ u = fgets_slash(line, sizeof(line)-1, x_stdin);
smbw_setshared("USER", u);
}