Skip to content

Commit

Permalink
Ask for password interactively
Browse files Browse the repository at this point in the history
if not specified in the command line
Closes #2
  • Loading branch information
maxsatula committed Aug 4, 2014
1 parent 06b53c1 commit 3fb5e18
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,17 +1028,17 @@ SELECT t.file_name,\
ExitWithUsage(&poptcon);
}

pwdptr = strchr(connectionString, '/');
if (pwdptr)
*pwdptr++ = '\0';
dbconptr = strchr(pwdptr, '@');
dbconptr = strchr(connectionString, '@');
if (dbconptr)
*dbconptr++ = '\0';
else
{
fprintf(stderr, "Invalid connection string format\n");
ExitWithUsage(&poptcon);
}
pwdptr = strchr(connectionString, '/');
if (pwdptr)
*pwdptr++ = '\0';

#ifdef DEBUG
printf("Database connection: %s@%s\n", connectionString, dbconptr);
Expand Down Expand Up @@ -1203,6 +1203,11 @@ SELECT t.file_name,\

poptFreeContext(poptcon);

if (!pwdptr)
pwdptr = getpass("Password: ");
if (!pwdptr)
ExitWithError(&oraAllInOne, 1, ERROR_OS, 0);

OracleLogon(&oraAllInOne, connectionString, pwdptr, dbconptr);

switch (programOptions.programAction)
Expand Down

0 comments on commit 3fb5e18

Please sign in to comment.