Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting calling domain name

Status
Not open for further replies.

btaber

Programmer
May 26, 2002
307
US
I would like to modify the auth library in courier-imap, I am a real newbie to C, but what I want to do is get the DNS domain name of what was used to connected to the server (like they connected to mail.something.com), and append that to their login name, if they did not specify their full email, so if they type in 'someuser' for login name, it automitacally makes it 'someuser@something.com', but if they use 'someuser@anotherhost.com', it does not do this. Please help, I need to do this for the dumb customers, they are kiling me....

B
 
Not being familiar with Courier-IMAP at all, but something like
[tt]if (strchr(username, '@') == NULL)
{
char buffer[512];
char hostname[256];
if (gethostname(hostname, 256) != 0)
perror("gethostname");
snprintf(buffer, 512, "%s@%s", username, hostname);
}[/tt]
should do what you want.

//Daniel
 
very close to what I was looking for, but is there any way to get the host name they actually type in, and not just the host name of the server?
ie. they typed:
telnet somewhere.com : returns somewhere.com
or
telnet somewhereelse.com : returns somewhereelse.com
?

B
 
No, as the client resolves the address to an IP before it connects to you. Unless you have a separate IP for each domain, you really have no way of knowing which domain they connected to.

//Daniel
 
I thought about that after I posted the message, guess my thoughts were correct. Thanks for the assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top