예제 #1
0
bool ZLFile::isDirectory() const {
	if (!myInfoIsFilled) {
		fillInfo();
	}
	return myInfo.IsDirectory;
}
예제 #2
0
static int
readHPSSconf()
{
    int i, j, cos, code = ENOENT;
    afs_uint64 value;
    struct stat64 tstat;
    char tbuffer[256];
    char minstr[128];
    char maxstr[128];
    char tmpstr[128];
    static time_t lastVersion = 0;

    if (!initialized) {
	MUTEX_INIT(&rxosd_hpss_mutex, "rxosd hpss lock", 0, 0);
	memset(&info, 0, sizeof(info));
	initialized = 1;
    }
    sprintf(tbuffer, "%s/HPSS.conf", AFSDIR_SERVER_BIN_DIRPATH);
    if (stat64(tbuffer, &tstat) == 0) {
	code = 0;
#ifdef AFS_AIX53_ENV
	if (tstat.st_mtime > lastVersion) {
#else
	if (tstat.st_mtim.tv_sec > lastVersion) {
#endif
	    bufio_p bp = BufioOpen(tbuffer, O_RDONLY, 0);
	    if (bp) {
		while (1) {
		    j = BufioGets(bp, tbuffer, sizeof(tbuffer));
		    if (j < 0)
			break;
		    j = sscanf(tbuffer, "COS %u min %s max %s",
				 &cos, &minstr, &maxstr);
		    if (j == 3) {
		        for (i=0; i<MAXCOS; i++) {
			    if (cos == info[i].cosId)
			        break;
			    if (info[i].cosId == 0)
			        break;
		        }
		        if (i<MAXCOS) 
			    code = fillInfo(&info[i], cos, minstr, maxstr);
		    } else {
		        j = sscanf(tbuffer, "PRINCIPAL %s", &tmpstr);
			if (j == 1) {
			    strncpy(ourPrincipal, tmpstr, sizeof(ourPrincipal));
			    ourPrincipal[sizeof(ourPrincipal) -1] = 0; /*just in case */
			    continue;
			}
		        j = sscanf(tbuffer, "KEYTAB %s", &tmpstr);
			if (j == 1) {
			    strncpy(ourKeytab, tmpstr, sizeof(ourKeytab));
			    ourKeytab[sizeof(ourKeytab) -1] = 0; /*just in case */
			    continue;
			}
		        j = sscanf(tbuffer, "PATH %s", &tmpstr);
			if (j == 1) {
			    strncpy(ourPath, tmpstr, sizeof(ourPath));
			    ourPath[sizeof(ourPath) -1] = 0; /*just in case */
			    continue;
			}
		        j = sscanf(tbuffer, "LIB %s", &tmpstr);
			if (j == 1) {
			    int k;
			    for (k=0; k<MAX_HPSS_LIBS; k++) {
				if (parms.ourLibs[k] == NULL)
				    break;
				if (strcmp(parms.ourLibs[k], tmpstr) == 0)
				    goto found;
			    }
			    for (k=0; k<MAX_HPSS_LIBS; k++) { 
				if (parms.ourLibs[k] == NULL) {
				    parms.ourLibs[k] = malloc(strlen(tmpstr) + 1);
				    sprintf(parms.ourLibs[k], "%s", tmpstr);
				    break;
				}
			    }
			found:
			    continue;
			}
		    }
		}
		BufioClose(bp);
	    }
	    if (!code)
#ifdef AFS_AIX53_ENV
		lastVersion = tstat.st_mtime;
#else
		lastVersion = tstat.st_mtim.tv_sec;
#endif
	}
    }
    return code;
}

static void checkCode(afs_int32 code)
{
    /*
     * If we get a code of -13 back from HPSS something is wrong with our
     * authentication. Try to force e new authentication.
     */
    if (code == -13) 	/* permission */
	*(rxosd_var->lastAuth) = 0;
}

/* 
 * This routine is called by the FiveMinuteCcheck
 */
afs_int32 
authenticate_for_hpss(void)
{
    afs_int32 code = 0, i;
    time_t now = time(0);
    static int authenticated = 0;
    char *principal;
    char *keytab;

    code = readHPSSconf();
    if (code)
	return code;

    if (now - *(rxosd_var->lastAuth) > TWENTYDAYS) {
	if (authenticated) {
	    waiting = 1;
	    while (HPSStransactions > 0) {
	        CV_WAIT(&auth_cond, &rxosd_hpss_mutex);
	    }
	    hpss_ClientAPIReset();
	    hpss_PurgeLoginCred();
	    authenticated = 0;
	}
	principal = &ourPrincipal;
	keytab = &ourKeytab;
        code = hpss_SetLoginCred(principal, hpss_authn_mech_krb5,
                             hpss_rpc_cred_client,
                             hpss_rpc_auth_type_keytab, keytab);
        if (!code) {
	    authenticated = 1;
	    *(rxosd_var->lastAuth) = now;
	}
	waiting = 0;
        if (waiters)
	    assert(pthread_cond_broadcast(&auth_cond) == 0);
    }
    return code;
}
예제 #3
0
std::size_t ZLFile::size() const {
	if (!myInfoIsFilled) {
		fillInfo();
	}
	return myInfo.Size;
}
예제 #4
0
bool ZLFile::exists() const {
	if (!myInfoIsFilled) {
		fillInfo();
	}
	return myInfo.Exists;
}
예제 #5
0
void SettingsTechnicalInfo::showEvent (QShowEvent * )
{
    qDebug() << Q_FUNC_INFO;
    fillInfo();
}
예제 #6
0
void PDFOutlineDock::changeLanguage()
{
	PDFDock::changeLanguage();
	if (filled)
		fillInfo();
}
예제 #7
0
void CObjInfo::init(CMapView *map, const mapView_t *view, const mapObj_t *obj)
//////////////////////////////////////////////////////////////////////////////
{
  CObjFillInfo info;

  m_map = map;

  ui->pushButton_3->setEnabled(false);
  ui->clb_slew->setEnabled(g_pTelePlugin && (g_pTelePlugin->getAttributes() & TPI_CAN_SLEW));
  ui->clb_sync->setEnabled(g_pTelePlugin && (g_pTelePlugin->getAttributes() & TPI_CAN_SYNC));
  ui->clb_tracking->setEnabled(obj->type == MO_PLANET ||
                               obj->type == MO_ASTER ||
                               obj->type == MO_COMET ||
                               obj->type == MO_SATELLITE);

  ui->cb_simbad->setDisabled(obj->type == MO_PLANET ||
                             obj->type == MO_ASTER ||
                             obj->type == MO_COMET ||
                             obj->type == MO_PLN_SAT ||
                             obj->type == MO_SATELLITE);

  ui->pushButton_2->setDisabled(obj->type == MO_PLANET ||
                                obj->type == MO_ASTER ||
                                obj->type == MO_COMET ||
                                obj->type == MO_PLN_SAT ||
                                obj->type == MO_SATELLITE);

  ui->pushButton_3->setEnabled(obj->type == MO_ASTER || obj->type == MO_COMET);


  info.fillInfo(view, obj, &m_infoItem);  

  /// read note
  QString str = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/data/notes/" + m_infoItem.id + ".txt";
  SkFile f(str);
  if (f.open(SkFile::ReadOnly | SkFile::Text))
  {
    ui->textEdit->setPlainText(f.readAll());
    f.close();
  }
  QTextCursor crs(ui->textEdit->textCursor());
  crs.movePosition(QTextCursor::End);
  ui->textEdit->setTextCursor(crs);
  /////////////

  fillInfo(view, &m_infoItem);

  ui->textEdit->setFocus();

  if (m_infoItem.type == MO_PLANET && m_infoItem.par1 != PT_EARTH_SHADOW)
  {
    m_pixmapWidget = new CPixmapWidget();
    ui->gridLayout_5->addWidget(m_pixmapWidget);
    m_pixmapWidget->setPixmap(getPlanetPixmap(m_pixmapWidget->width(), m_pixmapWidget->height()));

    CXMLSimpleMapParser parser;

    parser.begin(readAllFile("../data/planets/" + CAstro::getFileName(m_infoItem.par1) + ".xml"));

    QString str = "<table>\n";

    str += addPhysicalInfo(&parser, "Equator_radius", tr("Equator radius"));
    str += addPhysicalInfo(&parser, "Semi_major_axis", tr("Semi-major axis"));
    str += addPhysicalInfo(&parser, "Eccentricity", tr("Eccentricity"));
    str += addPhysicalInfo(&parser, "Mass", tr("Mass"));
    str += addPhysicalInfo(&parser, "Rotation_period", tr("Rotation period"));
    str += addPhysicalInfo(&parser, "Escape_velocity", tr("Escape velocity"));

    str +=  "</table>\n";

    ui->textBrowser_2->setHtml(str);
  }
  else
  {
    ui->tabWidget->blockSignals(true);
    ui->tabWidget->removeTab(1);
    ui->tabWidget->removeTab(1);
    ui->tabWidget->blockSignals(false);
  }
}