Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

rlogin/rsh incoming port

Programming


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-17-2004
andryk's Unix or Linux Image
andryk andryk is offline Forum Advisor  
Registered User
 
Join Date: Sep 2003
Last Activity: 5 June 2008, 4:15 AM EDT
Posts: 448
Thanks: 0
Thanked 1 Time in 1 Post
rlogin/rsh incoming port

Hi all,

In need to know why my sample code below that connect to a rlogind (513) fails, but original unix rlogin does not ? (.rhosts is verified to be correct)

I heard rlogin/rsh bind to a reserved port before connecting to the rlogin server. what are they ???


Code:
   s = socket(AF_INET, SOCK_STREAM, 0);
   sck.sin_family      = AF_INET;
   sck.sin_port        = htons(513);
   sck.sin_addr.s_addr = inet_addr("192.168.15.40");

   if (connect(s, (struct sockaddr *)&sck,sizeof(sck)) <0) {
      printf("connect() error\n"); return;
   }
   printf("Connected %d\n",s);
   write(s,"",1);
   write(s,"root",5);
   write(s,"root",5);
   write(s,"linux/38400",12);

   read(s,buf,sizeof(buf));
   printf("%s\n",buf);

Any help would be appreciated Linux
Sponsored Links
    #2  
Old Unix and Linux 08-17-2004
Perderabo's Unix or Linux Image
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 27 April 2015, 10:26 AM EDT
Location: Ashburn, Virginia
Posts: 9,931
Thanks: 64
Thanked 449 Times in 264 Posts
rlogin is suid to root. So it can rcmd() and the associated routines on the rcmd man page. That includes rresvport(). See those man pages. User program can use rexec() which also has a man page.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to allow incoming UDP packets with iptables crimputt Linux 1 04-21-2012 11:18 PM
incoming mails not coming harishindn Linux 4 08-08-2010 02:54 PM
handling incoming messages charlitos IP Networking 1 04-14-2009 04:19 PM
run a script from incoming email jojo77 UNIX for Dummies Questions & Answers 7 02-22-2008 12:48 PM
Listening on port for incoming data? frustrated1 Shell Programming and Scripting 6 01-16-2004 05:48 PM



All times are GMT -4. The time now is 09:28 PM.