system() asks for password

This is a discussion on system() asks for password within the Linux Programming forums, part of the Platform Specific Boards category; hello, I'm passing a command to system in this fasion: Code: sprintf(command, "curl -A SAMPLE-DOWNLOADER -url \"foobar.com/pass.asp?pass=pass&user=user\" > output.tmp\n", username, ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    2

    system() asks for password

    hello,

    I'm passing a command to system in this fasion:
    Code:
    sprintf(command, "curl -A SAMPLE-DOWNLOADER -url \"foobar.com/pass.asp?pass=pass&user=user\" > output.tmp\n", username, password );
    system (command);
    When i run this is a terminal window, i get asked to enter a password. Hitting enter lets me continue, but i need to do it without a password getting asked. any way i can do this?

    thanx, PRTSoft

  2. #2
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    why are you passing a username and password variables to sprintf() after your format string? there arent any conversion specifiers in it
    hello, internet!

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,671
    Look at other ways in which curl allows you to specify username/password information
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    2
    sorry i changed the text, in the original code block from what i had. here is what i HAVE:
    Code:
     sprintf(command, "curl -A SAMPLE-DOWNLOADER -url \"sermonaudio.com/xml_favorites2.asp"
    "?version=2.0&UserID=%s&Pass=%s\" > sermonlist.tmp\n", 
    username, password );
    this isn't a form. I am reverse enginering (with permission to do a port) a client that downloads sermon MP3s from sermonaudio.com. this is what it sends:

    sermonaudio.com/xml_favorites2.asp?version=2.0&UserID=usersid&Pass =password

    this supplies a list of sermons that were selected on the main site.
    so i used sprintf *in hindsight maybe strcpy would have been better) to put the username and password in the URL.

    If there is a better faster way to do it, i'm all ears.
    Last edited by Salem; 10-14-2004 at 01:23 AM. Reason: text wrapping

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File System Implementation
    By dodgeviper in forum C Programming
    Replies: 9
    Last Post: 11-16-2007, 12:04 PM
  2. Using system icons
    By @nthony in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2007, 06:56 PM
  3. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  4. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 04:35 PM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 06:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21