Example #1
0
void usage(const char *name) {
  fprintf(stdout,"%s%s%s\n",
	  I18N("AqBackup - Manage your backups\n"
	       "(c) 2003 Martin Preuss<*****@*****.**>\n"
	       "This library is free software; you can redistribute it and/or\n"
	       "modify it under the terms of the GNU Lesser General Public\n"
	       "License as published by the Free Software Foundation; either\n"
	       "version 2.1 of the License, or (at your option) any later version.\n"
	       "\n"
	       "Usage:\n"
	       k_PRG" [OPTIONS] \n"
	       "\nOptions:\n"
	       " -h            - show this help\n"
	       " -V            - show version information\n"
	       " -v            - be more verbous\n"
	       " --logfile F  - use given F as log file\n"
	       " --logtype T  - use given T as log type\n"
	       "                These are the valid types:\n"
	       "                  stderr (log to standard error channel)\n"
	       "                  file   (log to the file given by --logfile)\n"),
#ifdef HAVE_SYSLOG_H
	  I18N("                  syslog (log via syslog)\n"),
#else
	  "",
#endif
	  I18N("                Default is stderr\n"
	       " --loglevel L - set the loglevel\n"
	       "                Valid levels are:\n"
	       "                  emergency, alert, critical, error,\n"
	       "                  warning, notice, info and debug\n"
	       "                Default is \"warning\".\n"
	      ));
}
Example #2
0
static void
operateHost (char *host, int opCode, int confirm)
{
    char msg1[MAXLINELEN];
    char msg[MAXLINELEN];

    if (opCode == LIM_CMD_REBOOT)
	sprintf(msg1, I18N(256, "Restart LIM on <%s>"), host); /* catgets 256 */
    else
	sprintf(msg1, I18N(257, "Shut down LIM on <%s>"), host); /* catgets 257 */

    if (confirm) {
	sprintf(msg, "%s ? [y/n] ", msg1);
        if (!getConfirm(msg))
	    return;
    }
    fprintf(stderr, "%s ...... ", msg1);
    fflush(stderr);
    if (ls_limcontrol(host, opCode) == -1) {
	ls_perror ("ls_limcontrol");
	exitrc = -1;
    } else {
	char *delay = getenv("LSF_RESTART_DELAY");
	int  delay_time;
	if (delay == 0)
	    delay_time = 500;
	else
	    delay_time = atoi(delay) * 1000;

	millisleep_(delay_time);
	fprintf (stderr, "%s\n", I18N_done);
    }
    fflush(stderr);

}
Example #3
0
void
prtFileNames(struct jobInfoEnt *job, int prtCwd)
{
    char prline[MAXLINELEN];
    int i;

    
    if (prtCwd == TRUE) {
        if (job->cwd[0] == '/' || job->cwd[0] == '\\' || 
	    (job->cwd[0] != '\0' && job->cwd[1] == ':'))
	    sprintf(prline, ", CWD <%s>", job->cwd);
        else if (job->cwd[0] == '\0')
	    sprintf(prline, ", CWD <$HOME>"); 
        else
	    sprintf(prline, ", CWD <$HOME/%s>", job->cwd); 
        prtLine(prline);
    }

    
    if (job->submit.options & SUB_IN_FILE)  {
 	sprintf(prline, ", %s <%s>", 
	 	I18N(577, "Input File"), job->submit.inFile);/* catgets 577 */
 	prtLine(prline);
    }

    
    if (job->submit.options2 & SUB2_IN_FILE_SPOOL)  {
	sprintf(prline, ", %s(Spooled) <%s>", 
		I18N(577, "Input File"), job->submit.inFile);/* catgets 577 */
	prtLine(prline);
    }

    
    if (job->submit.options & SUB_OUT_FILE) {
        sprintf(prline, ", %s <%s>", 
	        I18N(578, "Output File"), job->submit.outFile);/* catgets 578 */
        prtLine(prline);
    }

    
    if (job->submit.options & SUB_ERR_FILE) {
        sprintf(prline, ", %s <%s>", 
		I18N(579, "Error File"), job->submit.errFile); /* catgets 579 */
        prtLine(prline);
    }

    
    if (job->submit.nxf) {
	sprintf(prline, ", %s",  I18N(580, "Copy Files")); /* catgets 580 */
	prtLine(prline);
    }
    
    for (i = 0; i < job->submit.nxf; i++) {
	sprintf(prline, " \"%s %s %s\"", job->submit.xf[i].subFn,
		strXfOptions(job->submit.xf[i].options),
		job->submit.xf[i].execFn);
	prtLine(prline);
    }

} 
Example #4
0
static int AH_NewKeyFileDialog_HandleActivatedIniLetter(GWEN_DIALOG *dlg) {
  AH_NEWKEYFILE_DIALOG *xdlg;
  int rv;
  GWEN_BUFFER *tbuf;


  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg);
  assert(xdlg);

  tbuf=GWEN_Buffer_new(0, 1024, 0, 1);

  /* add HTML version of the INI letter */
  GWEN_Buffer_AppendString(tbuf, "<html>");
  rv=AH_Provider_GetIniLetterHtml(AB_User_GetProvider(xdlg->user),
				  xdlg->user,
				  0,
				  0,
				  tbuf,
				  1);
  if (rv<0) {
    DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
    // TODO: show error message
    AB_Banking_ClearCryptTokenList(xdlg->banking);
    GWEN_Buffer_free(tbuf);
    return GWEN_DialogEvent_ResultHandled;
  }
  GWEN_Buffer_AppendString(tbuf, "</html>");


  /* add ASCII version of the INI letter for frontends which don't support HTML */
  rv=AH_Provider_GetIniLetterTxt(AB_User_GetProvider(xdlg->user),
				 xdlg->user,
				 0,
				 0,
				 tbuf,
				 0);
  if (rv<0) {
    DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
    // TODO: show error message
    AB_Banking_ClearCryptTokenList(xdlg->banking);
    GWEN_Buffer_free(tbuf);
    return GWEN_DialogEvent_ResultHandled;
  }

  rv=GWEN_Gui_Print(I18N("INI Letter"),
		    "HBCI-INILETTER",
		    I18N("INI Letter for HBCI"),
		    GWEN_Buffer_GetStart(tbuf),
		    0);
  if (rv<0) {
    DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
    // TODO: show error message
    GWEN_Buffer_free(tbuf);
    return GWEN_DialogEvent_ResultHandled;
  }

  GWEN_Buffer_free(tbuf);
  return GWEN_DialogEvent_ResultHandled;
}
Example #5
0
static struct idxList *
parseJobArrayIndex (char *jobName)
{
  struct idxList *idxList = NULL, *idx;
  char *index;
  int maxJLimit;
  static char fName[] = "parseJobArrayIndex";

  index = strchr (jobName, '[');
  if (!index)
    return (NULL);
  yybuff = index;
  if (idxparse (&idxList, &maxJLimit))
    {
      freeIdxList (idxList);
      if (idxerrno == IDX_MEM)
	fprintf (stderr, I18N_FUNC_FAIL, fName, "malloc");
      else
	fprintf (stderr, (_i18n_msg_get (ls_catd, NL_SETN, 1014, "%s: Bad job array index list.\n")), jobName);	/* catgets  1014  */
      return (NULL);
    }


  for (idx = idxList; idx; idx = idx->next)
    {
      if (idx->end == INFINIT_INT)
	idx->end = LSB_MAX_ARRAY_IDX;

      if (idx->start > idx->end)
	{
	  fprintf (stderr, "%d-%d: %s.\n", idx->start, idx->end, I18N (1015, "Job Array index invalid range"));	/* catgets 1015 */
	  freeIdxList (idxList);
	  return (NULL);
	}
      if ((idx->start <= 0) || (idx->start > LSB_MAX_ARRAY_IDX))
	{
	  fprintf (stderr, "%d: %s.\n", idx->start, I18N (1016, "Job Array index out of valid range"));	/* catgets  1016  */
	  freeIdxList (idxList);
	  return (NULL);
	}
      if ((idx->end <= 0) || (idx->end > LSB_MAX_ARRAY_IDX))
	{
	  fprintf (stderr, "%d: %s.\n",
		   idx->end,
		   I18N (1016, "Job Array index out of valid range"));
	  freeIdxList (idxList);
	  return (NULL);
	}
      if ((idx->step <= 0) || (idx->step > LSB_MAX_ARRAY_IDX))
	{
	  fprintf (stderr, "%d: %s.\n", idx->step, I18N (1018, "Job Array index step out of valid range"));	/* catgets  1018  */
	  freeIdxList (idxList);
	  return (NULL);
	}

    }
  return (idxList);
}
void AB_SetupNewUserDialog_Init(GWEN_DIALOG *dlg) {
  AB_SETUP_NEWUSER_DIALOG *xdlg;
  GWEN_DB_NODE *dbPrefs;
  int i;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg);
  assert(xdlg);

  dbPrefs=GWEN_Dialog_GetPreferences(dlg);

  GWEN_Dialog_SetCharProperty(dlg,
			      "",
			      GWEN_DialogProperty_Title,
			      0,
			      I18N("New User Wizard"),
			      0);

  /* select first page */
  GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, 0, 0);

  /* setup intro page */
  GWEN_Dialog_SetCharProperty(dlg,
			      "wiz_begin_label",
			      GWEN_DialogProperty_Title,
			      0,
                              I18N("<html>"
                                   "<p>This dialog assists you in creating an online banking user."
				   "The following steps are:</p>"
                                   "<ul>"
				   "<li>select the banking protocol</li>"
				   "<li>select the type of user to create</li>"
                                   "</ul>"
                                   "</html>"
                                   "This dialog assists you in creating an online banking user.\n"
                                   "The following steps are:\n"
                                   " - select the banking protocol\n"
				   " - select the type of user to create\n"),
			      0);

  /* read width */
  i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1);
  if (i>=DIALOG_MINWIDTH)
      GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0);

  /* read height */
  i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1);
  if (i>=DIALOG_MINHEIGHT)
      GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0);

  /* disable next and previous buttons */
  GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0);
  GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0);
}
Example #7
0
int AH_User_InputTan(AB_USER *u,
		     char *pwbuffer,
		     int minLen,
                     int maxLen){
  int rv;
  char buffer[512];
  const char *un;
  const char *bn=NULL;
  GWEN_BUFFER *nbuf;
  AB_BANKINFO *bi;

  assert(u);
  un=AB_User_GetUserId(u);
  /* find bank name */
  bi=AB_Banking_GetBankInfo(AB_User_GetBanking(u),
			    "de",
                            "*",
			    AB_User_GetBankCode(u));
  if (bi)
    bn=AB_BankInfo_GetBankName(bi);
  if (!bn)
    AB_User_GetBankCode(u);

  buffer[0]=0;
  buffer[sizeof(buffer)-1]=0;
  snprintf(buffer, sizeof(buffer)-1,
	   I18N("Please enter the next TAN\n"
		"for user %s at %s."
		"<html>"
		"Please enter the next TAN for user <i>%s</i> at "
		"<i>%s</i>."
		"</html>"),
	   un, bn,
           un, bn);
  buffer[sizeof(buffer)-1]=0;

  nbuf=GWEN_Buffer_new(0, 256 ,0 ,1);
  AH_User_MkTanName(u, NULL, nbuf);

  rv=GWEN_Gui_GetPassword(GWEN_GUI_INPUT_FLAGS_TAN |
			  /*GWEN_GUI_INPUT_FLAGS_NUMERIC |*/
			  GWEN_GUI_INPUT_FLAGS_SHOW,
			  GWEN_Buffer_GetStart(nbuf),
			  I18N("Enter TAN"),
			  buffer,
			  pwbuffer,
			  minLen,
			  maxLen,
			  0);
  GWEN_Buffer_free(nbuf);
  AB_BankInfo_free(bi);
  return rv;
}
Example #8
0
static void setUpComboFromDoubleStrings(GWEN_DIALOG *dlg,
                                        const char *comboBoxName,
                                        const char **strings,
                                        const char *s)
{
  int i;
  int j;
  const char *t1;
  const char *t2;

  GWEN_Dialog_SetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_ClearValues, 0, 0, 0);
  j=-1;
  for (i=0; ; i+=2) {
    t1=strings[i];
    if (t1==NULL)
      break;
    t2=strings[i+1];
    GWEN_Dialog_SetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_AddValue, 0, I18N(t2), 0);
    if (s && *s && strcasecmp(s, t1)==0)
      j=i/2;
  }
  if (j==-1) {
    if (s && *s) {
      GWEN_Dialog_SetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_AddValue, 0, s, 0);
      j=i/2;
    }
    else
      j=0;
  }
  GWEN_Dialog_SetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, 0, j, 0);
}
Example #9
0
static void
ctrlHost(char *host, int hStatus, int opCode, char *message)
{

    if (lsb_hostcontrol(host, opCode, message) < 0) {
        char i18nBuf[100];
        sprintf(i18nBuf,I18N_FUNC_FAILED,"Host control");
        lsb_perror (i18nBuf );
        exitrc = -1;
        return;
    }

    if (opCode == HOST_OPEN) {
        if (hStatus & (HOST_STAT_BUSY | HOST_STAT_WIND | HOST_STAT_LOCKED_MASTER
                       | HOST_STAT_LOCKED | HOST_STAT_FULL)) {
            fprintf(stderr, (_i18n_msg_get(ls_catd,NL_SETN,910, "done : host remains closed due to "))); /* catgets  910  */
            if (hStatus & HOST_STAT_LOCKED)
                fprintf (stderr, (_i18n_msg_get(ls_catd,NL_SETN,911, "being locked; "))); /* catgets  911  */
            else if (hStatus & HOST_STAT_LOCKED_MASTER)
                fprintf(stderr, (I18N(917, "being locked by master LIM;"))); /* catgets  917  */
            else if (hStatus & HOST_STAT_WIND)
                fprintf(stderr, (_i18n_msg_get(ls_catd,NL_SETN,912, "dispatch window; "))); /* catgets  912  */
            else if (hStatus & HOST_STAT_FULL)
                fprintf(stderr, (_i18n_msg_get(ls_catd,NL_SETN,913, "job limit; "))); /* catgets  913  */
            else if (hStatus & HOST_STAT_BUSY)
                fprintf(stderr, (_i18n_msg_get(ls_catd,NL_SETN,914, "load threshold; "))); /* catgets  914  */
            fprintf(stderr, " \n");
            return;
        }
    }

    fprintf(stderr, (_i18n_msg_get(ls_catd,NL_SETN,915, "done\n"))); /* catgets  915  */

}
Example #10
0
GWEN_DIALOG *AH_NewKeyFileDialog_new(AB_BANKING *ab) {
  GWEN_DIALOG *dlg;
  AH_NEWKEYFILE_DIALOG *xdlg;
  GWEN_BUFFER *fbuf;
  int rv;

  dlg=GWEN_Dialog_new("ah_setup_newkeyfile");
  GWEN_NEW_OBJECT(AH_NEWKEYFILE_DIALOG, xdlg);
  GWEN_INHERIT_SETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg, xdlg,
		       AH_NewKeyFileDialog_FreeData);
  GWEN_Dialog_SetSignalHandler(dlg, AH_NewKeyFileDialog_SignalHandler);

  /* get path of dialog description file */
  fbuf=GWEN_Buffer_new(0, 256, 0, 1);
  rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR,
			       "aqbanking/backends/aqhbci/dialogs/dlg_newkeyfile.dlg",
			       fbuf);
  if (rv<0) {
    DBG_INFO(AQHBCI_LOGDOMAIN, "Dialog description file not found (%d).", rv);
    GWEN_Buffer_free(fbuf);
    GWEN_Dialog_free(dlg);
    return NULL;
  }

  /* read dialog from dialog description file */
  rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf));
  if (rv<0) {
    DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d).", rv);
    GWEN_Gui_ShowError(I18N("Error"),
		       I18N("Could not read dialog description file [%s], maybe an installation error (%d)?"),
		       GWEN_Buffer_GetStart(fbuf), rv);
    GWEN_Buffer_free(fbuf);
    GWEN_Dialog_free(dlg);
    return NULL;
  }
  GWEN_Buffer_free(fbuf);

  xdlg->banking=ab;

  /* preset */
  xdlg->hbciVersion=210;
  xdlg->rdhVersion=0;

  /* done */
  return dlg;
}
Example #11
0
int
ctrlQueue (struct controlReq *qcReq, struct lsfAuth *auth)
{
  struct qData *qp;

  if ((qp = getQueueData (qcReq->name)) == NULL)
    return (LSBE_BAD_QUEUE);

  if (!isAuthManager (auth) && auth->uid != 0 && !isAuthQueAd (qp, auth))
    {
      ls_syslog (LOG_CRIT, I18N (7511, "ctrlQueue: uid <%d> not allowed to perform control operation"), auth->uid);	/* catgets 7511 */
      return (LSBE_PERMISSION);
    }

  if ((qcReq->opCode < QUEUE_OPEN) || (qcReq->opCode > QUEUE_INACTIVATE))
    return (LSBE_LSBLIB);

  if (qcReq->opCode == QUEUE_ACTIVATE && !(qp->qStatus & QUEUE_STAT_RUN))
    {
      qp->qStatus |= QUEUE_STAT_ACTIVE;
      log_queuestatus (qp, qcReq->opCode, auth->uid, auth->lsfUserName);
      return (LSBE_QUEUE_WINDOW);
    }

  if (((qp->qStatus & QUEUE_STAT_OPEN) &&
       (qcReq->opCode == QUEUE_OPEN))
      || (!(qp->qStatus & QUEUE_STAT_OPEN) &&
	  (qcReq->opCode == QUEUE_CLOSED))
      || ((qp->qStatus & QUEUE_STAT_ACTIVE) &&
	  (qcReq->opCode == QUEUE_ACTIVATE))
      || (!(qp->qStatus & QUEUE_STAT_ACTIVE) &&
	  (qcReq->opCode == QUEUE_INACTIVATE)))
    return (LSBE_NO_ERROR);

  if (qcReq->opCode == QUEUE_OPEN)
    {
      qp->qStatus |= QUEUE_STAT_OPEN;
      log_queuestatus (qp, qcReq->opCode, auth->uid, auth->lsfUserName);
    }
  if (qcReq->opCode == QUEUE_CLOSED)
    {
      qp->qStatus &= ~QUEUE_STAT_OPEN;
      log_queuestatus (qp, qcReq->opCode, auth->uid, auth->lsfUserName);
    }
  if (qcReq->opCode == QUEUE_ACTIVATE)
    {
      qp->qStatus |= QUEUE_STAT_ACTIVE;
      log_queuestatus (qp, qcReq->opCode, auth->uid, auth->lsfUserName);
    }
  if (qcReq->opCode == QUEUE_INACTIVATE)
    {
      qp->qStatus &= ~QUEUE_STAT_ACTIVE;
      log_queuestatus (qp, qcReq->opCode, auth->uid, auth->lsfUserName);
    }
  return (LSBE_NO_ERROR);

}
Example #12
0
int
limUnlock(int argc, char **argv)
{

    if (argc > optind) {
	fprintf(stderr, I18N(261, "Syntax error: too many arguments.\n")); /* catgets 261 */
	return(-2);
    }

    if (ls_unlockhost() < 0) {
        ls_perror("ls_unlockhost");
        return(-1);
    }

    printf(I18N(262, "Host is unlocked\n")); /* catgets 262 */
    fflush(stdout);

    return(0);
}
Example #13
0
void
prtAcctFinish(struct jobInfoEnt *job)
{
    char prline[MAXLINELEN];

    if (job->status == JOB_STAT_DONE)
        sprintf(prline, "%s: %s.\n",
		_i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &job->endTime),
		I18N(620, "Completed <done>")); /* catgets  620  */
    else if (job->status == JOB_STAT_EXIT)
        sprintf(prline, "%s: %s.\n",
	       _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &job->endTime),
	       I18N(621, "Completed <exit>")); /* catgets  621  */
    else
        sprintf(prline, "%s: %s.\n",
		_i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &job->endTime),
		I18N(622, "sbatchd unavail <zombi>"));  /* catgets  622  */
    prtLineWUF(prline);
}
Example #14
0
static void
print_long(struct resItem *res)
{

    char tempStr[15];
    static int first = TRUE;

    if (first) {
	printf("%s:  %s\n",
	   _i18n_msg_get(ls_catd,NL_SETN,1812, "RESOURCE_NAME"), /* catgets  1812  */
	   res->name);
        first = FALSE;
    } else
	printf("\n%s:  %s\n",
	    _i18n_msg_get(ls_catd,NL_SETN,1812, "RESOURCE_NAME"),
	    res->name);
    printf(_i18n_msg_get(ls_catd,NL_SETN,1814, "DESCRIPTION: %s\n"),res->des); /* catgets  1814  */

    printf("%-7.7s ", I18N(15, "TYPE"));  	/* catgets  1815  */
    printf("%5s  ",   I18N(1816, "ORDER"));  	/* catgets  1816  */
    printf("%9s ",    I18N(1817, "INTERVAL"));  /* catgets  1817  */
    printf("%8s ",    I18N(1818, "BUILTIN"));  	/* catgets  1818  */
    printf("%8s ",    I18N(1819, "DYNAMIC"));  	/* catgets  1819  */
    printf("%8s\n",   I18N(1820, "RELEASE"));  	/* catgets  1820  */

    sprintf(tempStr,"%d",res->interval);
    printf("%-7.7s %5s  %9s %8s %8s %8s\n",
            valueTypeToStr(res->valueType),
            orderTypeToStr(res->orderType),
            tempStr,
            flagToStr(res->flags & RESF_BUILTIN),
            flagToStr(res->flags & RESF_DYNAMIC),
            flagToStr(res->flags & RESF_RELEASE));
}
Example #15
0
LC_CLIENT_RESULT LC_Client_Init(LC_CLIENT *cl) {
  LONG rv;

  assert(cl);
  if (LC_Client_InitCommon()) {
    DBG_ERROR(LC_LOGDOMAIN, "Error on init");
    return LC_Client_ResultInternal;
  }

  /* establish context */
  rv=SCardEstablishContext(SCARD_SCOPE_SYSTEM,    /* scope */
			   NULL,                  /* reserved1 */
			   NULL,                  /* reserved2 */
			   &(cl->scardContext));  /* ptr to context */
  if (rv!=SCARD_S_SUCCESS) {
    if (rv == SCARD_E_NO_SERVICE) {
      DBG_ERROR(LC_LOGDOMAIN,
		"SCardEstablishContext: "
		"Error SCARD_E_NO_SERVICE: "
		"The Smartcard resource manager is not running. "
		"Maybe you have to start the Smartcard service manually?");
      GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error,
			   I18N("The PC/SC service is not running.\n"
				"Please make sure that the package \"pcscd\" is\n"
				"installed along with the appropriate driver.\n"
				"For cyberJack devices you will need to install\n"
				"the package \"ifd-cyberjack\" (Debian) or\n"
				"\"cyberjack-ifd\" (SuSE).\n"
				"For most other readers the package \"libccid\"\n"
				"needs to be installed."
				"<html>"
				"<p>The PC/SC service is not running.</p>"
				"<p>Please make sure that the package <b>pcscd</b> is "
				"installed along with the appropriate driver.</p>"
				"<p>For cyberJack devices you will need to install "
				"the package <b>ifd-cyberjack</b> (Debian) or "
				"<b>cyberjack-ifd</b> (SuSE).</p>"
				"<p>For most other readers the package <b>libccid</b> "
				"needs to be installed.</p>"
                                "</html>"));
    }
    else {
      DBG_ERROR(LC_LOGDOMAIN,
		"SCardEstablishContext: %ld (%04lx)", (long int) rv,
		rv);
    }
    LC_Client_FiniCommon();
    return LC_Client_ResultIoError;
  }

  return LC_Client_ResultOk;
}
Example #16
0
int AH_NewKeyFileDialog_HandleActivatedFileButton(GWEN_DIALOG *dlg) {
  AH_NEWKEYFILE_DIALOG *xdlg;
  int rv;
  const char *s;
  GWEN_BUFFER *pathBuffer;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg);
  assert(xdlg);

  pathBuffer=GWEN_Buffer_new(0, 256, 0, 1);
  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_filename_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    GWEN_Buffer_AppendString(pathBuffer, s);
  rv=GWEN_Gui_GetFileName(I18N("Create Keyfile"),
			  GWEN_Gui_FileNameType_SaveFileName,
			  0,
			  I18N("All Files (*)\tOHBCI Files (*ohbci;*.medium)"),
			  pathBuffer,
			  GWEN_Dialog_GetGuiId(dlg));
  if (rv==0) {
    GWEN_Dialog_SetCharProperty(dlg,
				"wiz_filename_edit",
				GWEN_DialogProperty_Value,
				0,
				GWEN_Buffer_GetStart(pathBuffer),
				0);
    rv=AH_NewKeyFileDialog_GetFilePageData(dlg);
    if (rv<0)
      GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0);
    else
      GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0);
  }
  else {
    DBG_NOTICE(AQHBCI_LOGDOMAIN, "here (%d)", rv);
  }
  GWEN_Buffer_free(pathBuffer);
  return GWEN_DialogEvent_ResultHandled;
}
Example #17
0
int
limLock(int argc, char **argv)
{
    u_long duration = 0;
    extern int optind;
    extern char *optarg;
    char *optName;

    while ((optName = myGetOpt(argc, argv, "l:")) != NULL) {
        switch(optName[0]) {
            case 'l':
                duration = atoi(optarg);
                if (!isint_(optarg) || atoi(optarg) <= 0) {
	            fprintf(stderr, I18N(258, "The host locking duration <%s> should be a positive integer\n"), optarg); /* catgets 258 */
                    return -2;
		}
		break;
            default:
                return -2;
        }
    }

    if (argc > optind)
        return -2;

    if (ls_lockhost(duration) < 0) {
	ls_perror("failed");
        return(-1);
    }

    if (duration)
        printf(I18N(259, "Host is locked for %lu seconds\n") /* catgets 259 */,
	       (unsigned long)duration);
    else
        printf(I18N(260, "Host is locked\n")); /* catgets 260 */

    fflush(stdout);
    return(0);
}
Example #18
0
void
prtBTTime(struct jobInfoEnt *job)
{
    char prline[MAXLINELEN];

    
    if (job->submit.beginTime > 0) {
        sprintf(prline, ", %s <%s>", 
	        I18N(572, "Specified Start Time"),  
                _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, 
			    (time_t *)&(job->submit.beginTime)));
        prtLine(prline);
    }
    
    if (job->submit.termTime > 0) {
        sprintf(prline, ", %s <%s>", 
		I18N(573, "Specified Termination Time"), 
                _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, 
			     (time_t *)&(job->submit.termTime)));
        prtLine(prline);
    }

} 
Example #19
0
int AH_ImExporterCtxFile_Import(AB_IMEXPORTER *ie,
				AB_IMEXPORTER_CONTEXT *ctx,
				GWEN_SYNCIO *sio,
				GWEN_DB_NODE *params){
  AH_IMEXPORTER_CTXFILE *ieh;
  GWEN_DB_NODE *dbData;
  int rv;

  assert(ie);
  ieh=GWEN_INHERIT_GETDATA(AB_IMEXPORTER, AH_IMEXPORTER_CTXFILE, ie);
  assert(ieh);

  dbData=GWEN_DB_Group_new("context");
  rv=GWEN_DB_ReadFromIo(dbData,
			sio,
			GWEN_DB_FLAGS_DEFAULT |
			GWEN_PATH_FLAGS_CREATE_GROUP);
  if (rv) {
    DBG_ERROR(AQBANKING_LOGDOMAIN, "Error importing data (%d)", rv);
    GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error,
			 "Error importing data");
    GWEN_DB_Group_free(dbData);
    return GWEN_ERROR_GENERIC;
  }

  /* transform DB to transactions */
  GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Notice,
		       I18N("Data imported, transforming to UTF-8"));
  rv=AB_ImExporter_DbFromIso8859_1ToUtf8(dbData);
  if (rv) {
    GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error,
			 "Error converting data");
    GWEN_DB_Group_free(dbData);
    return rv;
  }
  GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Notice,
		       "Transforming data to transactions");

  rv=AB_ImExporterContext_ReadDb(ctx, dbData);
  if (rv) {
    GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error,
			 "Error importing data");
    GWEN_DB_Group_free(dbData);
    return rv;
  }

  GWEN_DB_Group_free(dbData);
  return 0;
}
Example #20
0
int AH_NewKeyFileDialog_HandleActivatedSpecial(GWEN_DIALOG *dlg) {
  AH_NEWKEYFILE_DIALOG *xdlg;
  GWEN_DIALOG *dlg2;
  int rv;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg);
  assert(xdlg);

  dlg2=AH_RdhSpecialDialog_new(xdlg->banking);
  if (dlg2==NULL) {
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not create dialog");
    GWEN_Gui_ShowError(I18N("Error"), "%s", I18N("Could not create dialog, maybe an installation error?"));
    return GWEN_DialogEvent_ResultHandled;
  }

  AH_RdhSpecialDialog_SetFlags(dlg2, xdlg->flags);
  AH_RdhSpecialDialog_SetHbciVersion(dlg2, xdlg->hbciVersion);
  AH_RdhSpecialDialog_SetRdhVersion(dlg2, xdlg->rdhVersion);

  rv=GWEN_Gui_ExecDialog(dlg2, 0);
  if (rv==0) {
    /* rejected */
    GWEN_Dialog_free(dlg2);
    return GWEN_DialogEvent_ResultHandled;
  }
  else {
    xdlg->hbciVersion=AH_RdhSpecialDialog_GetHbciVersion(dlg2);
    xdlg->rdhVersion=AH_RdhSpecialDialog_GetRdhVersion(dlg2);
    xdlg->flags=AH_RdhSpecialDialog_GetFlags(dlg2);
  }

  GWEN_Dialog_free(dlg2);

  return GWEN_DialogEvent_ResultHandled;
}
Example #21
0
static
void doAllHosts (int opCode)
{
    int numhosts = 0, i;
    struct hostInfo *hostinfo;
    int ask = FALSE, try = FALSE;
    char msg[100];

    hostinfo = ls_gethostinfo("-:server", &numhosts, NULL, 0, LOCAL_ONLY);
    if (hostinfo == NULL) {
	ls_perror("ls_gethostinfo");
	fprintf(stderr, I18N(252, "Operation aborted\n")); /* catgets 252 */
        exitrc = -1;
	return;
    }

    if (!fFlag) {
	if (opCode == LIM_CMD_REBOOT)
            sprintf(msg, I18N(253, "Do you really want to restart LIMs on all hosts? [y/n] ")); /* catgets 253 */
        else
	    sprintf(msg, I18N(254, "Do you really want to shut down LIMs on all hosts? [y/n] ")); /* catgets 254 */
	ask = (!getConfirm(msg));
    }
    for (i=0; i<numhosts; i++)
        if (hostinfo[i].maxCpus > 0)
	    operateHost (hostinfo[i].hostName, opCode, ask);
        else
	    try = 1;
    if (try) {
        fprintf(stderr, "\n%s :\n\n", I18N(255, "Trying unavailable hosts")); /* catgets 255 */
        for (i=0; i<numhosts; i++)
            if (hostinfo[i].maxCpus <= 0)
	        operateHost (hostinfo[i].hostName, opCode, ask);
    }

}
Example #22
0
void usage(const char *prgname)
{
  fprintf(stdout, "%s%s",
          k_PRG_VERSION_INFO "\n",
          I18N(
            "-v               verbous\n"
            "--logfile ARG    name of the logfile\n"
            "--logtype ARG    log type\n"
            "--loglevel ARG   log level\n"
            "-d ARG           use ARG as domain prefix macro for function declarations\n"
            "-o ARG           name of output file (stdout if omitted)\n"
            "--compact        write a more compact file\n"
            "-V | --version   print version of this tool and exit\n"
          )
         );
}
Example #23
0
void
lsfExecLog(const char *cmd)
{
    static char fname[] = "lsfExecLog";
    char lsfUserName[MAXLSFNAMELEN];

    if (genParams_[LSF_MLS_LOG].paramValue &&
                ((genParams_[LSF_MLS_LOG].paramValue[0] == 'y') ||
                (genParams_[LSF_MLS_LOG].paramValue[0] == 'Y'))) {

        getLSFUser_(lsfUserName, sizeof(lsfUserName));
        syslog(LOG_INFO,
            I18N(6259,"%s: user - %s cmd - '%s'"), /* catgets 6259 */
            fname, lsfUserName, cmd);

    }
}
Example #24
0
int EBC_Provider_ExecAccountQueue(AB_PROVIDER *pro,
				  AB_IMEXPORTER_CONTEXT *ctx,
				  AB_USER *u,
				  GWEN_HTTP_SESSION *sess,
				  EBC_ACCOUNTQUEUE *aq){
  EBC_PROVIDER *dp;
  int errors=0;
  int oks=0;
  AB_ACCOUNT *a;
  EBC_CONTEXT_LIST *cl;

  assert(pro);
  dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
  assert(dp);

  a=EBC_AccountQueue_GetAccount(aq);

  cl=EBC_AccountQueue_GetContextList(aq);
  if (cl) {
    EBC_CONTEXT *ectx;

    ectx=EBC_Context_List_First(cl);
    while(ectx) {
      int rv;

      rv=EBC_Provider_ExecContext(pro, ctx, u, a, sess, ectx);
      if (!rv)
	oks++;
      else
	errors++;

      if (rv==GWEN_ERROR_USER_ABORTED) {
	DBG_INFO(AQEBICS_LOGDOMAIN, "User aborted");
	GWEN_Gui_ProgressLog(0,
			     GWEN_LoggerLevel_Error,
			     I18N("User aborted"));
	return rv;
      }

      ectx=EBC_Context_List_Next(ectx);
    }
  }

  return 0;
}
Example #25
0
int
copyFile(lsRcpXfer *lsXfer, char* buf, int option )
{
    char szThisHost[MAXHOSTNAMELEN];
    struct stat sLstat, sRstat;
    int iRetVal = 0, len = 0;
    int lfd, rfd;
    int file_no_exist = FALSE;
    int ret = 0;
    mode_t mode;
    char fname[]="copyFile";
    static struct hostent pheHostBuf, pheDestBuf;
    struct hostent *hp1, *hp2;
    static int first = 1;

    if (first) {
        memset(&pheHostBuf, 0, sizeof(struct hostent));
        memset(&pheDestBuf, 0, sizeof(struct hostent));
        first = 0;
    }

    if (pheHostBuf.h_name != NULL) {
        free(pheHostBuf.h_name);
    }

    if (pheDestBuf.h_name != NULL) {
        free(pheDestBuf.h_name);
    }

    strcpy(szThisHost, ls_getmyhostname());

    lserrno = LSE_FILE_SYS;

    if (strcmp(lsXfer->szHostUser, lsXfer->szDestUser) != 0) {
	ls_syslog(LOG_ERR,
         I18N(6050,"%s: %s does not support account mapping using rcp"), /* catgets 6050*/
                  fname,"RES");
	return -1;
    }

    if ((hp1 = Gethostbyname_(lsXfer->szHost)) == NULL) {
        ls_syslog(LOG_ERR, "\
%s gethostbyname() failed for %s", __func__, lsXfer->szHost);
        return -1;
    }
Example #26
0
static void getarglist(char *argstr, char *arglist[], int n)
{
   int i;

   arglist[0] = strtok(argstr, " ");

    for (i = 1; i < n; i++) {
        arglist[i] = strtok(NULL, " ");
        if (arglist[i] == NULL)
            break;
    }

    if (i == n) {
        fprintf(stderr, "getarglist: %s\n",
	        I18N(1254, "too many arguments") /* catgets 1254 */);
        exit(-1);
    }
}
Example #27
0
void usage(const char *name, const char *ustr) {
  fprintf(stdout,
          I18N("KVKCard3 - A tool to read information from a German medical card.\n"
               "(c) 2007 Martin Preuss<*****@*****.**>\n"
               "This library is free software; you can redistribute it and/or\n"
               "modify it under the terms of the GNU Lesser General Public\n"
               "License as published by the Free Software Foundation; either\n"
               "version 2.1 of the License, or (at your option) any later version.\n"
               "\n"
               "Usage: %s COMMAND [OPTIONS]\n"
               "\n"
               "Available commands:\n"
               "  read   : read data from a German medical card\n"
               "\n"
               "Available options:\n"
               "%s\n"),
          name,
          ustr);
}
Example #28
0
static void getpids(int argc, char *argv[])
{
    int i, pid;

    for (i = 0; optind < argc; optind++) {
        pid = atoi(argv[optind]);
        if (pid != 0) {
            if (i < MAX_PIDS)
                pids[i++] = pid;
            else {
                fprintf(stderr,  "lsacct: %s pids\n",
		        I18N(1201, "too many")); /* catgets 1201 */
                exit(-1);
            }
        }
    }

    pids[i] = 0;
}
Example #29
0
static void 
getCloseString(int hStatus, char **status)
{
    if (hStatus & HOST_STAT_DISABLED)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1635, "closed_Adm")); /* catgets  1635  */
    else if (hStatus & HOST_STAT_EXCLUSIVE)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1636, "closed_Excl")); /* catgets  1636  */
    else if (hStatus & HOST_STAT_LOCKED)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1637, "closed_Lock")); /* catgets  1637  */
    else if (hStatus & HOST_STAT_LOCKED_MASTER)
        *status = (I18N(1643, "closed_LockM")); /* catgets  1643  */
    else if (hStatus & HOST_STAT_NO_LIM)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1638, "closed_LIM")); /* catgets  1638  */
    else if (hStatus & HOST_STAT_WIND)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1639, "closed_Wind")); /* catgets  1639  */
    else if (hStatus & HOST_STAT_FULL)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1640, "closed_Full")); /* catgets  1640  */
    else if (hStatus & HOST_STAT_BUSY)
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1641, "closed_Busy")); /* catgets  1641  */
    else
        *status = (_i18n_msg_get(ls_catd,NL_SETN,1642, "unknown")); /* catgets  1642  */
} 
void AH_ChooseUserTypeDialog_Init(GWEN_DIALOG *dlg) {
  GWEN_Dialog_SetCharProperty(dlg, "hbciIntroLabel", GWEN_DialogProperty_Title, 0,
                              I18N("<html>"
                                   "<p>The HBCI module supports a broad range of security "
				   "media. Please choose the user setup mode from the following "
                                   "list.</p>"
                                   "<p>Click on the <i>run</i> button below to create the user.</p>"
                                   "</html>"
                                   "The HBCI module supports a broad range of security\n"
                                   "media. Please choose the user setup mode from the following\n"
                                   "list.\n"
                                   "Click on the RUN button below to create the user."
                                  ),
			      0);

  switch(AB_UserTypePageDialog_GetSelectedType(dlg)) {
  case AqHBCI_NewUserDialog_CodeGeneric:
  case AqHBCI_NewUserDialog_CodeExistingPinTan:
    GWEN_Dialog_SetIntProperty(dlg, "hbciPinTanRadio", GWEN_DialogProperty_Value, 0, 1, 0);
    break;

  case AqHBCI_NewUserDialog_CodeCreateKeyFile:
    GWEN_Dialog_SetIntProperty(dlg, "hbciCreateKeyFileRadio", GWEN_DialogProperty_Value, 0, 1, 0);
    break;
  case AqHBCI_NewUserDialog_CodeExistingKeyFile:
    GWEN_Dialog_SetIntProperty(dlg, "hbciImportKeyFileRadio", GWEN_DialogProperty_Value, 0, 1, 0);
    break;
  case AqHBCI_NewUserDialog_CodeCreateChipcard:
    GWEN_Dialog_SetIntProperty(dlg, "hbciInitChipcardRadio", GWEN_DialogProperty_Value, 0, 1, 0);
    break;
  case AqHBCI_NewUserDialog_CodeExistingChipcard:
    GWEN_Dialog_SetIntProperty(dlg, "hbciUseChipcardRadio", GWEN_DialogProperty_Value, 0, 1, 0);
    break;
  }

  /* temporarily disable not-implemented buttons */
  GWEN_Dialog_SetIntProperty(dlg, "hbciInitChipcardRadio", GWEN_DialogProperty_Enabled, 0, 0, 0);
}