Example #1
0
dpySpec *fetchSessions(int flags)
{
    dpySpec *sess, *sessions = 0, tsess;

    GSet(1);
    GSendInt(G_List);
    GSendInt(flags);
next:
    while((tsess.display = GRecvStr()))
    {
        tsess.from = GRecvStr();
#ifdef HAVE_VTS
        tsess.vt = GRecvInt();
#endif
        tsess.user = GRecvStr();
        tsess.session = GRecvStr();
        tsess.flags = GRecvInt();
        if((tsess.flags & isTTY) && *tsess.from)
            for(sess = sessions; sess; sess = sess->next)
                if(sess->user && !strcmp(sess->user, tsess.user) && !strcmp(sess->from, tsess.from))
                {
                    sess->count++;
                    disposeSession(&tsess);
                    goto next;
                }
        if(!(sess = malloc(sizeof(*sess))))
            LogPanic("Out of memory\n");
        tsess.count = 1;
        tsess.next = sessions;
        *sess = tsess;
        sessions = sess;
    }
    GSet(0);
    return sessions;
}
Example #2
0
static void ReqCfg(int id)
{
    GSendInt(G_GetCfg);
    GSendInt(id);
    switch(GRecvInt())
    {
        case GE_NoEnt:
            LogPanic("Config value %#x not available\n", id);
        case GE_BadType:
            LogPanic("Core does not know type of config value %#x\n", id);
    }
}
Example #3
0
void KCheckPass::handleVerify()
{
    int ret;
    char *arr;

    if (GRecvInt( &ret )) {
        switch (ret) {
        case ConvGetBinary:
            if (!GRecvArr( &arr ))
                break;
            // FIXME: not supported
            cantCheck();
            if (arr)
                ::free( arr );
            return;
        case ConvGetNormal:
            if (!GRecvArr( &arr ))
                break;
            GSendStr(m_password.toUtf8().constData());
            if (!m_password.isEmpty()) {
                // IsSecret
                GSendInt(1);
            }
            if (arr)
                ::free( arr );
            return;
        case ConvGetHidden:
            if (!GRecvArr( &arr ))
                break;
            GSendStr(m_password.toUtf8().constData());
            if (!m_password.isEmpty()) {
                // IsSecret
                GSendInt(1);
            }
            if (arr)
                ::free( arr );
            return;
        case ConvPutInfo:
            if (!GRecvArr( &arr ))
                break;
            emit message(QString::fromLocal8Bit(arr));
            ::free( arr );
            return;
        case ConvPutError:
            if (!GRecvArr( &arr ))
                break;
            emit error(QString::fromLocal8Bit(arr));
            ::free( arr );
            return;
        }
    }
    reapVerify();
}
Example #4
0
int
startConfig( int what, CfgDep *dep, int force )
{
	int ret;

	if ((ret = needsReScan( what, dep )) < 0 || (!ret && !force))
		return ret;
	OpenGetter();
	GSendInt( GC_GetConf );
	GSendInt( what );
	GSendStr( dep->name->str );
	return 1;
}
Example #5
0
void
TDMShutdown::scheduleShutdown( TQWidget *_parent )
{
	GSet( 1 );
	GSendInt( G_QueryShutdown );
	int how = GRecvInt();
	int start = GRecvInt();
	int timeout = GRecvInt();
	int force = GRecvInt();
	int uid = GRecvInt();
	char *os = GRecvStr();
	GSet( 0 );
	if (how) {
		int ret =
			TDMCancelShutdown( how, start, timeout, force, uid, os,
			                   _parent ).exec();
		if (!ret)
			return;
		doShutdown( 0, 0 );
		uid = ret == Authed ? 0 : -1;
	} else
		uid = -1;
	if (os)
		free( os );
	TDMShutdown( uid, _parent ).exec();
}
Example #6
0
void ChooserDlg::addHostname()
{
	if (!iline->text().isEmpty()) {
		GSendInt( G_Ch_RegisterHost );
		GSendStr( iline->text().latin1() );
		iline->clear();
	}
}
Example #7
0
static void
SendValues( ValArr *va )
{
	Value *cst;
	int i, nu;

	GSendInt( va->nents );
	GSendInt( va->nptrs );
	GSendInt( 0/*va->nints*/ );
	GSendInt( va->nchars );
	for (i = 0; i < va->nents; i++) {
		GSendInt( va->ents[i].id & ~C_PRIVATE );
		switch (va->ents[i].id & C_TYPE_MASK) {
		case C_TYPE_INT:
			GSendInt( (int)va->ents[i].val.ptr );
			break;
		case C_TYPE_STR:
			GSendNStr( va->ents[i].val.ptr, va->ents[i].val.len - 1 );
			break;
		case C_TYPE_ARGV:
			cst = (Value *)va->ents[i].val.ptr;
			for (nu = 0; cst[nu].ptr; nu++);
			GSendInt( nu );
			for (; cst->ptr; cst++)
				GSendNStr( cst->ptr, cst->len );
			break;
		}
	}
}
Example #8
0
void ChooserDlg::accept()
{
	if (focusWidget() == iline) {
		if (!iline->text().isEmpty()) {
			GSendInt( G_Ch_DirectChoice );
			GSendStr( iline->text().latin1() );
			iline->clear();
		}
		return;
	} else /*if (focusWidget() == host_view)*/ {
		QListViewItem *item = host_view->currentItem();
		if (item) {
			GSendInt( G_Ready );
			GSendInt( ((ChooserListViewItem *)item)->id );
			::exit( EX_NORMAL );
		}
	}
}
Example #9
0
static int
GetDeps()
{
	int ncf, i, dep, ret;
	CfgFile *cf;

	OpenGetter();
	GSendInt( GC_Files );
	ncf = GRecvInt();
	if (!(cf = Malloc( ncf * sizeof(*cf) ))) {
		CloseGetter();
		return 0;
	}
	for (i = 0; i < ncf; i++) {
		cf[i].name = newStr( GRecvStr() );
		if ((dep = cf[i].depidx = GRecvInt()) != -1)
			cf[i].deptime = mTime( cf[dep].name->str );
	}
	if (cfgFiles) {
		for (i = 0; i < numCfgFiles; i++)
			delStr( cfgFiles[i].name );
		free( cfgFiles );
	}
	ret = 1;
	cfgFiles = cf;
	numCfgFiles = ncf;
	for (i = 0; i < as(cfgMapT); i++) {
		GSendInt( cfgMapT[i] );
		if ((cfgMap[i] = GRecvInt()) < 0) {
			LogError( "Config reader does not support config cathegory %#x\n",
			          cfgMapT[i] );
			ret = 0;
		}
	}
	GSendInt( -1 );
	return ret;
}
Example #10
0
static void
doShutdown( int type, const char *os )
{
	GSet( 1 );
	GSendInt( G_Shutdown );
	GSendInt( type );
	GSendInt( 0 );
	GSendInt( 0 );
	GSendInt( SHUT_FORCE );
	GSendInt( 0 ); /* irrelevant, will timeout immediately anyway */
	GSendStr( os );
	GSet( 0 );
}
Example #11
0
void
TDMShutdown::accepted()
{
	GSet( 1 );
	GSendInt( G_Shutdown );
	GSendInt( restart_rb->isChecked() ? SHUT_REBOOT : SHUT_HALT );
	GSendInt( sch_st );
	GSendInt( sch_to );
	GSendInt( cb_force->isChecked() ? SHUT_FORCE : SHUT_CANCEL );
	GSendInt( _allowShutdown == SHUT_ROOT ? 0 : -2 );
	GSendStr( (restart_rb->isChecked() &&
	           targets && targets->currentItem() != oldTarget) ?
	          targets->currentText().local8Bit().data() : 0 );
	GSet( 0 );
	inherited::accepted();
}
Example #12
0
void Greeter::gplugReturnText( const char *text, int tag )
{
    GSendStr( text );
    if (text)
        GSendInt( tag );
}
Example #13
0
TDMSlimShutdown::TDMSlimShutdown( TQWidget *_parent )
	: inherited( _parent )
	, targetList( 0 )
{
	setCaption(i18n("Shutdown TDE"));

	bool doUbuntuLogout = TDEConfigGroup(TDEGlobal::config(), "Shutdown").readBoolEntry("doUbuntuLogout", false);

	TQFrame* lfrm = new TQFrame( this );
	TQHBoxLayout* hbuttonbox;

	if(doUbuntuLogout)
	{
		TQVBoxLayout* vbox = new TQVBoxLayout( this );
		if (has_twin)
			lfrm->setFrameStyle( TQFrame::NoFrame );
		else
			lfrm->setFrameStyle( TQFrame::StyledPanel | TQFrame::Raised );
		lfrm->setLineWidth( style().pixelMetric( TQStyle::PM_DefaultFrameWidth, lfrm ) );
		// we need to set the minimum size for the logout box, since it
		// gets too small if there all options are not available
		lfrm->setMinimumSize(300,120);
		vbox->addWidget( lfrm );
		vbox = new TQVBoxLayout( lfrm, 2 * KDialog::marginHint(),
								2 * KDialog::spacingHint() );

		// first line of buttons
		hbuttonbox = new TQHBoxLayout( vbox, 8 * KDialog::spacingHint() );
		hbuttonbox->setAlignment( Qt::AlignHCenter );

		// Reboot
		FlatButton* btnReboot = new FlatButton( lfrm );
		btnReboot->setTextLabel( i18n("&Restart"), false );
		btnReboot->setPixmap( DesktopIcon( "reload") );
                int i = btnReboot->textLabel().find( TQRegExp("\\&"), 0 );    // i == 1
                btnReboot->setAccel( "ALT+" + btnReboot->textLabel().lower()[i+1] ) ;
		hbuttonbox->addWidget ( btnReboot);
		connect(btnReboot, TQT_SIGNAL(clicked()), TQT_SLOT(slotReboot()));
		
		// Copied completely from the standard restart/shutdown dialog
		GSet( 1 );
		GSendInt( G_ListBootOpts );
		if (GRecvInt() == BO_OK) {
			targetList = GRecvStrArr( 0 );
			/*int def =*/ GRecvInt();
			int cur = GRecvInt();
			TQPopupMenu *targets = new TQPopupMenu( this );
			btnReboot->setPopupDelay(300); // visually add dropdown
			for (int i = 0; targetList[i]; i++) {
				TQString t( TQString::fromLocal8Bit( targetList[i] ) );
				targets->insertItem( i == cur ?
									i18n("current option in boot loader",
										"%1 (current)").arg( t ) :
									t, i );
			}
			btnReboot->setPopup( targets );
			connect( targets, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReboot(int)) );
		}
		GSet( 0 );
		// Copied completely from the standard restart/shutdown dialog

		// Shutdown
		FlatButton* btnHalt = new FlatButton( lfrm );
		btnHalt->setTextLabel( i18n("&Turn Off"), false );
		btnHalt->setPixmap( DesktopIcon( "system-log-out") );
                i = btnHalt->textLabel().find( TQRegExp("\\&"), 0 );    // i == 1
                btnHalt->setAccel( "ALT+" + btnHalt->textLabel().lower()[i+1] ) ;
		hbuttonbox->addWidget ( btnHalt );
		connect(btnHalt, TQT_SIGNAL(clicked()), TQT_SLOT(slotHalt()));

		// cancel buttonbox
		TQHBoxLayout* hbuttonbox2 = new TQHBoxLayout( vbox, 8 * KDialog::spacingHint()  );
		hbuttonbox2->setAlignment( Qt::AlignRight );

		// Back to tdm
		KSMPushButton* btnBack = new KSMPushButton( KStdGuiItem::cancel(), lfrm );
		hbuttonbox2->addWidget( btnBack );
		connect(btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject()));
	}
	else
	{
		TQHBoxLayout *hbox = new TQHBoxLayout( this, KDmh, KDsh );
		if (has_twin)
			lfrm->setFrameStyle( TQFrame::NoFrame );
		else
			lfrm->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
		hbox->addWidget( lfrm, AlignCenter );
		// we need to set the minimum size for the logout box, since it
		// gets too small if there all options are not available
		TQLabel *icon = new TQLabel( lfrm );
		icon->setPixmap( TQPixmap( locate( "data", "tdm/pics/shutdown.jpg" ) ) );
		TQVBoxLayout *iconlay = new TQVBoxLayout( lfrm );
		iconlay->addWidget( icon );
	
		TQVBoxLayout *buttonlay = new TQVBoxLayout( hbox, KDsh );
	
		buttonlay->addStretch( 1 );
	
		KPushButton *btnHalt = new
			KPushButton( KGuiItem( i18n("&Turn Off Computer"), "system-log-out" ), this );
		buttonlay->addWidget( btnHalt );
		connect( btnHalt, TQT_SIGNAL(clicked()), TQT_SLOT(slotHalt()) );
	
		buttonlay->addSpacing( KDialog::spacingHint() );
	
		TDMDelayedPushButton *btnReboot = new
			TDMDelayedPushButton( KGuiItem( i18n("&Restart Computer"), "reload" ), this );
		buttonlay->addWidget( btnReboot );
		connect( btnReboot, TQT_SIGNAL(clicked()), TQT_SLOT(slotReboot()) );
	
		GSet( 1 );
		GSendInt( G_ListBootOpts );
		if (GRecvInt() == BO_OK) {
			targetList = GRecvStrArr( 0 );
			/*int def =*/ GRecvInt();
			int cur = GRecvInt();
			TQPopupMenu *targets = new TQPopupMenu( this );
			for (int i = 0; targetList[i]; i++) {
				TQString t( TQString::fromLocal8Bit( targetList[i] ) );
				targets->insertItem( i == cur ?
									i18n("current option in boot loader",
										"%1 (current)").arg( t ) :
									t, i );
			}
			btnReboot->setPopup( targets );
			connect( targets, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReboot(int)) );
		}
		GSet( 0 );
	
		buttonlay->addStretch( 1 );
	
		if (_scheduledSd != SHUT_NEVER) {
			KPushButton *btnSched = new
				KPushButton( KGuiItem( i18n("&Schedule...") ), this );
			buttonlay->addWidget( btnSched );
			connect( btnSched, TQT_SIGNAL(clicked()), TQT_SLOT(slotSched()) );
	
			buttonlay->addStretch( 1 );
		}
	
		buttonlay->addWidget( new KSeparator( this ) );
	
		buttonlay->addSpacing( 0 );
	
		KPushButton *btnBack = new KPushButton( KStdGuiItem::cancel(), this );
		buttonlay->addWidget( btnBack );
		connect( btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject()) );
	
		buttonlay->addSpacing( KDialog::spacingHint() );	
	}

}
Example #14
0
static void
ReadAccessFile( const char *fname )
{
	HostEntry *hostList, **hostPtr = &hostList;
	AliasEntry *aliasList, **aliasPtr = &aliasList;
	AclEntry *acList, **acPtr = &acList, *acl;
	ListenEntry *listenList, **listenPtr = &listenList;
	char *displayOrAlias, *hostOrAlias;
	File file;
	int nHosts, nAliases, nAcls, nListens, nChars, error, bad;
	int i, len;

	nHosts = nAliases = nAcls = nListens = nChars = error = 0;
	if (!readFile( &file, fname, "XDMCP access control" ))
		goto sendacl;
	while ((displayOrAlias = ReadWord( &file, &len, FALSE ))) {
		if (*displayOrAlias == ALIAS_CHARACTER)
		{
			if (!(*aliasPtr = (AliasEntry *)Malloc( sizeof(AliasEntry)))) {
				error = 1;
				break;
			}
			(*aliasPtr)->name = displayOrAlias + 1;
			nChars += len;
			(*aliasPtr)->hosts = nHosts;
			(*aliasPtr)->pHosts = hostPtr;
			(*aliasPtr)->nhosts = 0;
			(*aliasPtr)->hasBad = 0;
			while ((hostOrAlias = ReadWord( &file, &len, TRUE ))) {
				if (ParseHost( &nHosts, &hostPtr, &nChars, hostOrAlias, len,
				               PARSE_NO_BCAST ))
					(*aliasPtr)->nhosts++;
				else
					(*aliasPtr)->hasBad = 1;
			}
			aliasPtr = &(*aliasPtr)->next;
			nAliases++;
		}
		else if (!strcmp( displayOrAlias, LISTEN_STRING ))
		{
			if (!(*listenPtr = (ListenEntry *)Malloc( sizeof(ListenEntry)))) {
				error = 1;
				break;
			}
			(*listenPtr)->iface = nHosts;
			if (!(hostOrAlias = ReadWord( &file, &len, TRUE )) ||
			    !strcmp( hostOrAlias, WILDCARD_STRING ) ||
			    !ParseHost( &nHosts, &hostPtr, &nChars, hostOrAlias, len,
			                PARSE_NO_BCAST|PARSE_NO_PAT|PARSE_NO_ALIAS ))
			{
				(*listenPtr)->iface = -1;
			}
			(*listenPtr)->mcasts = nHosts;
			(*listenPtr)->nmcasts = 0;
			while ((hostOrAlias = ReadWord( &file, &len, TRUE ))) {
				if (ParseHost( &nHosts, &hostPtr, &nChars, hostOrAlias, len,
				               PARSE_NO_BCAST|PARSE_NO_PAT|PARSE_NO_ALIAS ))
					(*listenPtr)->nmcasts++;
			}
			listenPtr = &(*listenPtr)->next;
			nListens++;
		}
		else
		{
			if (!(*acPtr = (AclEntry *)Malloc( sizeof(AclEntry)))) {
				error = 1;
				break;
			}
			(*acPtr)->flags = 0;
			if (*displayOrAlias == NEGATE_CHARACTER) {
				(*acPtr)->flags |= a_notAllowed;
				displayOrAlias++;
			} else if (*displayOrAlias == EQUAL_CHARACTER)
				displayOrAlias++;
			(*acPtr)->entries = nHosts;
			(*acPtr)->pEntries = hostPtr;
			(*acPtr)->nentries = 1;
			if (!ParseHost( &nHosts, &hostPtr, &nChars, displayOrAlias, len,
			                PARSE_NO_BCAST ))
			{
				bad = 1;
				if ((*acPtr)->flags & a_notAllowed) {
					LogError( "XDMCP ACL: unresolved host in denying rule\n" );
					error = 1;
				}
			} else
				bad = 0;
			(*acPtr)->hosts = nHosts;
			(*acPtr)->pHosts = hostPtr;
			(*acPtr)->nhosts = 0;
			while ((hostOrAlias = ReadWord( &file, &len, TRUE ))) {
				if (!strcmp( hostOrAlias, CHOOSER_STRING ))
					(*acPtr)->flags |= a_useChooser;
				else if (!strcmp( hostOrAlias, NOBROADCAST_STRING ))
					(*acPtr)->flags |= a_notBroadcast;
				else {
					if (ParseHost( &nHosts, &hostPtr, &nChars,
					               hostOrAlias, len, PARSE_NO_PAT ))
						(*acPtr)->nhosts++;
				}
			}
			if (!bad) {
				acPtr = &(*acPtr)->next;
				nAcls++;
			}
		}
	}

	if (!nListens) {
		if (!(*listenPtr = (ListenEntry *)Malloc( sizeof(ListenEntry))))
			error = 1;
		else {
			(*listenPtr)->iface = -1;
			(*listenPtr)->mcasts = nHosts;
			(*listenPtr)->nmcasts = 0;
#if defined(IPv6) && defined(AF_INET6) && defined(XDM_DEFAULT_MCAST_ADDR6)
			if (ParseHost( &nHosts, &hostPtr, &nChars,
			               XDM_DEFAULT_MCAST_ADDR6,
			               sizeof(XDM_DEFAULT_MCAST_ADDR6)-1,
			               PARSE_ALL ))
				(*listenPtr)->nmcasts++;
#endif
			nListens++;
		}
	}

	for (acl = acList, i = 0; i < nAcls; i++, acl = acl->next)
		if (checkHostlist( acl->pEntries, acl->nentries, aliasList, nAliases,
		                   0, (acl->flags & a_notAllowed) ? CHECK_NOT : 0 ) ||
		    checkHostlist( acl->pHosts, acl->nhosts, aliasList, nAliases,
		                   0, CHECK_NO_PAT ))
			error = 1;

	if (error) {
		nHosts = nAliases = nAcls = nListens = nChars = 0;
	  sendacl:
		LogError( "No XDMCP requests will be granted\n" );
	}
	GSendInt( nHosts );
	GSendInt( nListens );
	GSendInt( nAliases );
	GSendInt( nAcls );
	GSendInt( nChars );
	for (i = 0; i < nHosts; i++, hostList = hostList->next) {
		GSendInt( hostList->type );
		switch (hostList->type) {
		case HOST_ALIAS:
			GSendStr( hostList->entry.aliasPattern );
			break;
		case HOST_PATTERN:
			GSendStr( hostList->entry.hostPattern );
			break;
		case HOST_ADDRESS:
			GSendArr( hostList->entry.displayAddress.hostAddrLen,
			          hostList->entry.displayAddress.hostAddress );
			GSendInt( hostList->entry.displayAddress.connectionType );
			break;
		}
	}
	for (i = 0; i < nListens; i++, listenList = listenList->next) {
		GSendInt( listenList->iface );
		GSendInt( listenList->mcasts );
		GSendInt( listenList->nmcasts );
	}
	for (i = 0; i < nAliases; i++, aliasList = aliasList->next) {
		GSendStr( aliasList->name );
		GSendInt( aliasList->hosts );
		GSendInt( aliasList->nhosts );
	}
	for (i = 0; i < nAcls; i++, acList = acList->next) {
		GSendInt( acList->entries );
		GSendInt( acList->nentries );
		GSendInt( acList->hosts );
		GSendInt( acList->nhosts );
		GSendInt( acList->flags );
	}
}
Example #15
0
TDMShutdown::TDMShutdown( int _uid, TQWidget *_parent )
	: inherited( _uid, _parent )
{
	setCaption(i18n("Shutdown TDE"));

	TQSizePolicy fp( TQSizePolicy::Fixed, TQSizePolicy::Fixed );

	TQHBoxLayout *hlay = new TQHBoxLayout( box, KDsh );

	howGroup = new TQVButtonGroup( i18n("Shutdown Type"), this );
	hlay->addWidget( howGroup, 0, AlignTop );

	TQRadioButton *rb;
	rb = new TDMRadioButton( i18n("&Turn off computer"), howGroup );
	rb->setChecked( true );
	rb->setFocus();

	restart_rb = new TDMRadioButton( i18n("&Restart computer"), howGroup );

	connect( rb, TQT_SIGNAL(doubleClicked()), TQT_SLOT(accept()) );
	connect( restart_rb, TQT_SIGNAL(doubleClicked()), TQT_SLOT(accept()) );

	GSet( 1 );
	GSendInt( G_ListBootOpts );
	if (GRecvInt() == BO_OK) { /* XXX show dialog on failure */
		char **tlist = GRecvStrArr( 0 );
		int defaultTarget = GRecvInt();
		oldTarget = GRecvInt();
		TQWidget *hlp = new TQWidget( howGroup );
		targets = new TQComboBox( hlp );
		for (int i = 0; tlist[i]; i++)
			targets->insertItem( TQString(TQString::fromLocal8Bit( tlist[i] )) );
		freeStrArr( tlist );
		targets->setCurrentItem( oldTarget == -1 ? defaultTarget : oldTarget );
		TQHBoxLayout *hb = new TQHBoxLayout( hlp, 0, KDsh );
		int spc = kapp->style().pixelMetric( TQStyle::PM_ExclusiveIndicatorWidth )
		          + howGroup->insideSpacing();
		hb->addSpacing( spc );
		hb->addWidget( targets );
		connect( targets, TQT_SIGNAL(activated( int )), TQT_SLOT(slotTargetChanged()) );
	}
	GSet( 0 );

	howGroup->setSizePolicy( fp );

	schedGroup = new TQGroupBox( i18n("Scheduling"), this );
	hlay->addWidget( schedGroup, 0, AlignTop );

	le_start = new TQLineEdit( schedGroup );
	TQLabel *lab1 = new TQLabel( le_start, i18n("&Start:"), schedGroup );

	le_timeout = new TQLineEdit( schedGroup );
	TQLabel *lab2 = new TQLabel( le_timeout, i18n("T&imeout:"), schedGroup );

	cb_force = new TQCheckBox( i18n("&Force after timeout"), schedGroup );
	if (_allowNuke != SHUT_NONE) {
		connect( cb_force, TQT_SIGNAL(clicked()), TQT_SLOT(slotWhenChanged()) );
		mayNuke = true;
	} else
		cb_force->setEnabled( false );

	TQGridLayout *grid = new TQGridLayout( schedGroup, 0, 0, KDmh, KDsh );
	grid->addRowSpacing( 0, schedGroup->fontMetrics().height() - 5 );
	grid->addWidget( lab1, 1, 0, Qt::AlignRight );
	grid->addWidget( le_start, 1, 1 );
	grid->addWidget( lab2, 2, 0, Qt::AlignRight );
	grid->addWidget( le_timeout, 2, 1 );
	grid->addMultiCellWidget( cb_force, 3,3, 0,1 );

	schedGroup->setSizePolicy( fp );

	le_start->setText( "0" );
	if (_defSdMode == SHUT_SCHEDULE)
		le_timeout->setText( "-1" );
	else {
		le_timeout->setText( "0" );
		if (_defSdMode == SHUT_FORCENOW && cb_force->isEnabled())
			cb_force->setChecked( true );
	}

	complete( schedGroup );
}
Example #16
0
int main( int argc ATTR_UNUSED, char **argv )
{
	DSpec dspec;
	ValArr va;
	char *ci, *disp, *dcls, *cfgfile;
	int what;

	if (!(ci = getenv( "CONINFO" ))) {
		fprintf( stderr, "This program is part of kdm and should not be run manually.\n" );
		return 1;
	}
	if (sscanf( ci, "%d %d", &rfd, &wfd ) != 2)
		return 1;

	InitLog();

	if ((debugLevel = GRecvInt()) & DEBUG_WCONFIG)
		sleep( 100 );

/*	Debug ("parsing command line\n");*/
	if (**++argv)
		kdmrc = *argv;
/*
	while (*++argv) {
	}
*/

	for (;;) {
/*		Debug ("Awaiting command ...\n");*/
		if (!GRecvCmd( &what ))
			break;
		switch (what) {
		case GC_Files:
/*			Debug ("GC_Files\n");*/
			ReadConf();
			CopyValues( 0, &secGeneral, 0, C_CONFIG );
#ifdef XDMCP
			CopyValues( 0, &secXdmcp, 0, C_CONFIG );
			GSendInt( 2 );
#else
			GSendInt( 1 );
#endif
			GSendStr( kdmrc );
				GSendInt( -1 );
#ifdef XDMCP
			GSendNStr( VXaccess.ptr, VXaccess.len - 1 );
				GSendInt( 0 );
#endif
			for (; (what = GRecvInt()) != -1; )
				switch (what) {
				case GC_gGlobal:
				case GC_gDisplay:
					GSendInt( 0 );
					break;
#ifdef XDMCP
				case GC_gXaccess:
					GSendInt( 1 );
					break;
#endif
				default:
					GSendInt( -1 );
					break;
				}
			break;
		case GC_GetConf:
/*		Debug( "GC_GetConf\n" );*/
			memset( &va, 0, sizeof(va) );
			what = GRecvInt();
			cfgfile = GRecvStr();
			switch (what) {
			case GC_gGlobal:
/*		Debug( "GC_gGlobal\n" );*/
				Debug( "getting global config\n" );
				ReadConf();
				CopyValues( &va, &secGeneral, 0, 0 );
#ifdef XDMCP
				CopyValues( &va, &secXdmcp, 0, 0 );
#endif
				CopyValues( &va, &secShutdown, 0, 0 );
				SendValues( &va );
				break;
			case GC_gDisplay:
/*		Debug( "GC_gDisplay\n" );*/
				disp = GRecvStr();
/*		Debug( " Display %s\n", disp );*/
				dcls = GRecvStr();
/*		Debug( " Class %s\n", dcls );*/
				Debug( "getting config for display %s, class %s\n", disp, dcls );
				MkDSpec( &dspec, disp, dcls ? dcls : "" );
				ReadConf();
				CopyValues( &va, &sec_Core, &dspec, 0 );
				CopyValues( &va, &sec_Greeter, &dspec, 0 );
				free( disp );
				if (dcls)
					free( dcls );
				SendValues( &va );
				break;
#ifdef XDMCP
			case GC_gXaccess:
				ReadAccessFile( cfgfile );
				break;
#endif
			default:
				Debug( "Unsupported config category %#x\n", what );
			}
			free( cfgfile );
			break;
		default:
			Debug( "Unknown config command %#x\n", what );
		}
	}

/*	Debug( "Config reader exiting ..." );*/
	return EX_NORMAL;
}
Example #17
0
void ChooserDlg::pingHosts()
{
	GSendInt( G_Ch_Refresh );
}