rlogin/rsh incoming port | Unix Linux Forums | Programming

  Go Back    


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

rlogin/rsh incoming port

Programming


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-17-2004
andryk's Avatar
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
Sponsored Links
    #2  
Old 08-17-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 28 November 2014, 10:37 AM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 438 Times in 261 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 Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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-22-2012 12:18 AM
incoming mails not coming harishindn Linux 4 08-08-2010 03:54 PM
handling incoming messages charlitos IP Networking 1 04-14-2009 05:19 PM
run a script from incoming email jojo77 UNIX for Dummies Questions & Answers 7 02-22-2008 01:48 PM
Listening on port for incoming data? frustrated1 Shell Programming and Scripting 6 01-16-2004 06:48 PM



All times are GMT -4. The time now is 12:47 PM.