git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@298 ec53bebd-3082-4978-b11e-865c3cabbd6b
		
			
				
	
	
		
			28 lines
		
	
	
		
			472 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			472 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include "krb5_locl.h"
 | 
						|
 | 
						|
 | 
						|
krb5_error_code
 | 
						|
krb5_get_lrealm(char **realm)
 | 
						|
{
 | 
						|
  FILE *F;
 | 
						|
  char s[128];
 | 
						|
  char *p, *q;
 | 
						|
  F = fopen("/etc/krb5.conf", "r");
 | 
						|
  while(fgets(s, 128, F)){
 | 
						|
    if((p = strstr(s, "default_realm"))){
 | 
						|
      p = strchr(p, '=');
 | 
						|
      p++;
 | 
						|
      while(isspace(*p)) p++;
 | 
						|
      q = p;
 | 
						|
      while(isalnum(*p) || strchr("_.-", *p)) p++;
 | 
						|
      *p=0;
 | 
						|
      *realm = strdup(q);
 | 
						|
      fclose(F);
 | 
						|
      return 0;
 | 
						|
    }
 | 
						|
  }
 | 
						|
  fclose(F);
 | 
						|
  *realm = 0;
 | 
						|
  return 0;
 | 
						|
}
 |