Пример #1
0
wxPopplerConvPPM::wxPopplerConvPPM(const wxString &name, const wxString &usr, const wxString &own)
{
	Initialize();
	if (!globalParams) {
		globalParams = new GlobalParams();
	}
	SetTargetFile(name);
	SetUserPassword(usr);
	SetOwnerPassword(own);
	
	isopen = AssignFile();
}
Пример #2
0
int RegisterUser(int argc, char **argv)
{
  char *args[MAX_ARGS_SIZE];
  char *login, *potype = NULL;
  char temp_buf[BUFSIZ];
  int status, i;

  for (i = 0; i < MAX_ARGS_SIZE; i++)
    args[i] = NULL;

  Put_message("This function has NO kerberos support, so strange things");
  Put_message("may happen if you use it to register a user.");

  switch (YesNoQuestion("Do you know the users UID Number (y/n)", FALSE))
    {
    case TRUE:
      Prompt_input("What is the UID number of the user? ", temp_buf, BUFSIZ);
      args[0] = strdup(temp_buf);
      break;
    case FALSE:
      if (!(args[0] = GetUidNumberFromName()))
	return DM_NORMAL;
      break;
    default:
      return DM_NORMAL;
    }

  sprintf(temp_buf, "u%s", args[0]);
  login = strdup(temp_buf);
  if (GetValueFromUser("Login name for this user? ", &login) == SUB_ERROR)
    {
      args[1] = login;
      FreeInfo(args);	   /* This work because the NULL temination is ok. */
      return DM_NORMAL;
    }
  Put_message("KERBEROS code not added, did not reserve name with kerberos.");
  args[1] = login;
  
  sprintf(temp_buf, "EXCHANGE");
  potype = strdup(temp_buf);
  if (GetValueFromUser("P.O. Box Type for this user? ", &potype) == SUB_ERROR)
    {
      args[2] = potype;
      FreeInfo(args);
      return DM_NORMAL;
    }
  if (strcmp(potype, "POP") && strcmp(potype, "IMAP") && strcmp(potype, "EXCHANGE"))
    {
      sprintf(temp_buf, "Unknown P.O. Box type.");
      Put_message(temp_buf);
      FreeInfo(args);
      return DM_NORMAL;
    }
  args[2] = potype;
  args[3] = NULL;

  switch ((status = do_mr_query("register_user", CountArgs(args),
				args, NULL, NULL)))
    {
    case MR_SUCCESS:
      sprintf(temp_buf, "User %s successfully registered.", login);
      Put_message(temp_buf);
      SetUserPassword(login);
      break;
    case MR_IN_USE:
      GiveBackLogin(login);
      sprintf(temp_buf, "The username %s is already in use.", login);
      Put_message(temp_buf);
      break;
    default:
      com_err(program_name, status, " in register_user");
      break;
    }
  FreeInfo(args);
  return DM_NORMAL;
}