[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: Bug#18639: klipper freeze logout ldap
From: Michael Matz <matz () ifh ! de>
Date: 2001-01-17 12:09:29
[Download RAW message or body]
Hi,
On Tue, 16 Jan 2001, Stephan Kulow wrote:
> Jure Pecar wrote:
> >
> > > > Can't get own host name. Your system is severely misconfigured
> > > This looks worst.
> > >
> > Yes, but this way it works. Machine names get resolved trough ldap and i
> > suspetct the problem is somewhere here ... how does KDE do hostname
> > resolving? If it does not get it's hostname, it complains but works, if
> > it gets its hostname via dns, it works, if it gets its hostname via
> > ldap, it locks on logout.
> >
> char * safeSmsGenerateClientID( SmsConn c )
> {
> char *ret = SmsGenerateClientID(c);
> if (!ret) {
> qDebug("Can't get own host name. Your system is severely
> misconfigured\n");
Your error message indicates, that SmsGenerateClientID() returned
NULL. It's slightly working the following way:
SmsGenerateClientID() {
if (gethostname(hostname, sizeof(hostname))) return NULL;
hostp = gethostbyname(hostname);
if (!hostp) return NULL;
char *inet_addr = inet_ntoa(*(struct in_addr*)(hostp->h_addr));
if (*inet_addr isn't of form a.b.c.d, or a,b,c or d are > 3 characters*)
return NULL;
return a string;
}
// optionally the gethostbyname() used is the reentrant version
// of the C-library
You see now the reason for my error message ("severely misconfigured"). If
one can't get it's own hostname, or that's not resolvable by a normal
system-call, or that doesn't correspond to a nice IPv4 address, the system
_is_ misconfigured. I too have once used LDAP as NIS replacement, and
besides some quirks it even was working quite well, but I don't remember
if I also replaced DNS (I darkly remember problems with it, or at least no
performance improvements).
So basically you might try to write a small test c-program imitating the
work of SmsGenerateClientID(), and print out which routine isn't working
as expected. Ohh, I'm in a good mood today, so I attached a test program.
If it prints no error messages then also SmsGenerateClientID() should
work. If not, I would like to know more.
Ciao,
Michael.
["testsmsgen_id.c" (TEXT/plain)]
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
int main()
{
char hostname[256];
char *inet_addr;
char *ptr1, *ptr2;
struct hostent *hostp;
int i, len;
if (gethostname(hostname, sizeof (hostname)))
{
perror ("gethostname");
return 1;
}
hostname[255] = 0;
printf("my hostname : %s\n", hostname);
hostp = gethostbyname (hostname);
if (!hostp)
{
perror ("gethostbyname");
return 2;
}
inet_addr = inet_ntoa (*(struct in_addr *)(hostp->h_addr));
printf("my inet_addr: %s\n", inet_addr);
for (ptr1=inet_addr, i=0; i<3; i++)
{
ptr2 = strchr(ptr1, '.');
len = ptr2 - ptr1;
if (!ptr2 || len > 3)
{
printf("wrong address format\n");
return 3;
}
ptr1 = ptr2 + 1;
}
return 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic