~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

  • Committer: Monty Taylor
  • Date: 2010-06-19 16:36:52 UTC
  • mto: This revision was merged to the branch mainline in revision 1628.
  • Revision ID: mordred@inaugust.com-20100619163652-6fej38011wsop52k
Moved password parsing code into get_password.cc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
 
167
167
/* Buffer to hold 'version' and 'version_comment' */
168
168
const int MAX_SERVER_VERSION_LENGTH= 128;
169
 
const string PASSWORD_SENTINEL("\0\0\0\0\0", 5);
170
169
 
171
170
#define PROMPT_CHAR '\\'
172
171
 
290
289
  opt_compress= false, opt_shutdown= false, opt_ping= false,
291
290
  vertical= false, line_numbers= true, column_names= true,
292
291
  opt_nopager= true, opt_outfile= false, named_cmds= false,
293
 
  tty_password= false, opt_nobeep= false, opt_reconnect= true,
 
292
  opt_nobeep= false, opt_reconnect= true,
294
293
  opt_secure_auth= false,
295
294
  default_pager_set= false, opt_sigint_ignore= false,
296
295
  auto_vertical_output= false,
1347
1346
  opt_max_input_line*=1024;
1348
1347
}
1349
1348
 
1350
 
static pair<string, string> parse_password_arg(std::string s)
1351
 
{
1352
 
  if (s.find("--password") == 0)
1353
 
  {
1354
 
    if (s == "--password")
1355
 
    {
1356
 
      tty_password= true;
1357
 
      //check if no argument is passed.
1358
 
      return make_pair("password", PASSWORD_SENTINEL);
1359
 
    }
1360
 
 
1361
 
    if (s.substr(10,3) == "=\"\"" || s.substr(10,3) == "=''")
1362
 
    {
1363
 
      // Check if --password="" or --password=''
1364
 
      return make_pair("password", PASSWORD_SENTINEL);
1365
 
    }
1366
 
    
1367
 
    if(s.substr(10) == "=" && s.length() == 11)
1368
 
    {
1369
 
      // check if --password= and return a default value
1370
 
      return make_pair("password", PASSWORD_SENTINEL);
1371
 
    }
1372
 
  }
1373
 
 
1374
 
  return make_pair(string(""), string(""));
1375
 
}
1376
 
 
1377
1349
int main(int argc,char *argv[])
1378
1350
{
1379
1351
try