The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
run a script from incoming email jojo77 UNIX for Dummies Questions & Answers 7 02-22-2008 10:48 AM
find number of incoming requests to a server laddu UNIX for Dummies Questions & Answers 1 03-09-2007 10:48 PM
Check incoming mail to sendmail kingdbag UNIX for Dummies Questions & Answers 1 01-25-2007 08:32 PM
loggin incoming ftp connections in syslog zuessh AIX 2 05-31-2006 02:07 PM
Listening on port for incoming data? frustrated1 Shell Programming and Scripting 6 01-16-2004 03:48 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-17-2004
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
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
Reply With Quote
Forum Sponsor
  #2  
Old 08-17-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0