SOURCES: kde4-kdebase-workspace-kdmconfig.patch - one more kdmrc path

arekm arekm at pld-linux.org
Mon Mar 2 09:41:03 CET 2009


Author: arekm                        Date: Mon Mar  2 08:41:03 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- one more kdmrc path

---- Files affected:
SOURCES:
   kde4-kdebase-workspace-kdmconfig.patch (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: SOURCES/kde4-kdebase-workspace-kdmconfig.patch
diff -u SOURCES/kde4-kdebase-workspace-kdmconfig.patch:1.7 SOURCES/kde4-kdebase-workspace-kdmconfig.patch:1.8
--- SOURCES/kde4-kdebase-workspace-kdmconfig.patch:1.7	Mon Mar  2 09:40:12 2009
+++ SOURCES/kde4-kdebase-workspace-kdmconfig.patch	Mon Mar  2 09:40:57 2009
@@ -175,6 +175,3187 @@
 -exec_program(\"${CMAKE_CURRENT_BINARY_DIR}/genkdmconf\" ARGS --in \\\"\\\$DESTDIR${CONFIG_INSTALL_DIR}/kdm\\\" --no-in-notice --face-src \\\"${CMAKE_CURRENT_SOURCE_DIR}/pics\\\" \\\$GENKDMCONF_FLAGS)
 +exec_program(\"${CMAKE_CURRENT_BINARY_DIR}/genkdmconf\" ARGS --in \\\"\\\${DESTDIR}/etc/X11/kdm\\\" --no-in-notice --face-src \\\"${CMAKE_CURRENT_SOURCE_DIR}/pics\\\" \\\$GENKDMCONF_FLAGS)
  ")
+diff -urN kdebase-workspace-4.2.1.org/kdm/kfrontend/genkdmconf.c kdebase-workspace-4.2.1/kdm/kfrontend/genkdmconf.c
+--- kdebase-workspace-4.2.1.org/kdm/kfrontend/genkdmconf.c	2008-12-04 09:34:57.000000000 +0100
++++ kdebase-workspace-4.2.1/kdm/kfrontend/genkdmconf.c	2009-03-02 09:40:48.236729510 +0100
+@@ -3116,7 +3116,7 @@
+ 	f = createFile( "README", 0644 );
+ 	fprintf( f,
+ "This automatically generated configuration consists of the following files:\n" );
+-	fprintf( f, "- " KDMCONF "/kdmrc\n" );
++	fprintf( f, "- /etc/X11/kdm/kdmrc\n" );
+ 	for (fp = aflist; fp; fp = fp->next)
+ 		fprintf( f, "- %s\n", fp->str );
+ 	if (use_destdir && !no_in_notice)
+diff -urN kdebase-workspace-4.2.1.org/kdm/kfrontend/genkdmconf.c~ kdebase-workspace-4.2.1/kdm/kfrontend/genkdmconf.c~
+--- kdebase-workspace-4.2.1.org/kdm/kfrontend/genkdmconf.c~	1970-01-01 01:00:00.000000000 +0100
++++ kdebase-workspace-4.2.1/kdm/kfrontend/genkdmconf.c~	2008-12-04 09:34:57.000000000 +0100
+@@ -0,0 +1,3165 @@
++/*
++
++Create a suitable configuration for kdm taking previous xdm/kdm
++installations into account
++
++Copyright (C) 2001-2005 Oswald Buddenhagen <ossi at kde.org>
++
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
++
++*/
++
++#include <greet.h>
++
++#include <X11/Xlib.h>
++#include <X11/Xresource.h>
++
++#include <sys/types.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++#include <ctype.h>
++#include <stdarg.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <utime.h>
++#include <dirent.h>
++#include <errno.h>
++#include <pwd.h>
++#include <time.h>
++#include <limits.h>
++#include <sys/stat.h>
++#include <sys/param.h>
++#ifdef BSD
++# include <utmp.h>
++#endif
++
++#define WANT_CONF_GEN
++#include <config.ci>
++
++#define RCVERSTR stringify(RCVERMAJOR) "." stringify(RCVERMINOR)
++
++static int old_scripts, no_old_scripts, old_confs, no_old,
++	no_backup, no_in_notice, use_destdir, mixed_scripts;
++static const char *newdir = KDMCONF, *facesrc = KDMDATA "/pics/users",
++	*oldxdm, *oldkde, *oldkdepfx;
++
++static int oldver;
++
++
++typedef struct StrList {
++	struct StrList *next;
++	const char *str;
++} StrList;
++
++typedef struct StrMap {
++	struct StrMap *next;
++	const char *key, *value;
++} StrMap;
++
++
++static void *
++mmalloc( size_t sz )
++{
++	void *ptr;
++
++	if (!(ptr = malloc( sz ))) {
++		fprintf( stderr, "Out of memory\n" );
++		exit( 1 );
++	}
++	return ptr;
++}
++
++static void *
++mcalloc( size_t sz )
++{
++	void *ptr;
++
++	if (!(ptr = calloc( 1, sz ))) {
++		fprintf( stderr, "Out of memory\n" );
++		exit( 1 );
++	}
++	return ptr;
++}
++
++static void *
++mrealloc( void *optr, size_t sz )
++{
++	void *ptr;
++
++	if (!(ptr = realloc( optr, sz ))) {
++		fprintf( stderr, "Out of memory\n" );
++		exit( 1 );
++	}
++	return ptr;
++}
++
++static char *
++mstrdup( const char *optr )
++{
++	char *ptr;
++
++	if (!optr)
++		return 0;
++	if (!(ptr = strdup( optr ))) {
++		fprintf( stderr, "Out of memory\n" );
++		exit( 1 );
++	}
++	return ptr;
++}
++
++
++#define NO_LOGGER
++#define STATIC static
++#include <printf.c>
++
++typedef struct {
++	char *buf;
++	int clen, blen, tlen;
++} OCABuf;
++
++static void
++outCh_OCA( void *bp, char c )
++{
++	OCABuf *ocabp = (OCABuf *)bp;
++
++	ocabp->tlen++;
++	if (ocabp->clen >= ocabp->blen) {
++		ocabp->blen = ocabp->blen * 3 / 2 + 100;
++		ocabp->buf = mrealloc( ocabp->buf, ocabp->blen );
++	}
++	ocabp->buf[ocabp->clen++] = c;
++}
++
++static int
++VASPrintf( char **strp, const char *fmt, va_list args )
++{
++	OCABuf ocab = { 0, 0, 0, -1 };
++
++	doPrint( outCh_OCA, &ocab, fmt, args );
++	outCh_OCA( &ocab, 0 );
++	*strp = realloc( ocab.buf, ocab.clen );
++	if (!*strp)
++		*strp = ocab.buf;
++	return ocab.tlen;
++}
++
++static int
++ASPrintf( char **strp, const char *fmt, ... )
++{
++	va_list args;
++	int len;
++
++	va_start( args, fmt );
++	len = VASPrintf( strp, fmt, args );
++	va_end( args );
++	return len;
++}
++
++static void
++strCat( char **strp, const char *fmt, ... )
++{
++	char *str, *tstr;
++	va_list args;
++	int el;
++
++	va_start( args, fmt );
++	el = VASPrintf( &str, fmt, args );
++	va_end( args );
++	if (*strp) {
++		int ol = strlen( *strp );
++		tstr = mmalloc( el + ol + 1 );
++		memcpy( tstr, *strp, ol );
++		memcpy( tstr + ol, str, el + 1 );
++		free( *strp );
++		free( str );
++		*strp = tstr;
++	} else
++		*strp = str;
++}
++
++
++#define WANT_CLOSE 1
++
++typedef struct File {
++	char *buf, *eof, *cur;
++#if defined(HAVE_MMAP) && defined(WANT_CLOSE)
++	int ismapped;
++#endif
++} File;
++
++static int
++readFile( File *file, const char *fn )
++{
++	off_t flen;
++	int fd;
++
++	if ((fd = open( fn, O_RDONLY )) < 0)
++		return False;
++
++	flen = lseek( fd, 0, SEEK_END );
++#ifdef HAVE_MMAP
++# ifdef WANT_CLOSE
++	file->ismapped = False;
++# endif
++	file->buf = mmap( 0, flen + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0 );
++# ifdef WANT_CLOSE
++	if (file->buf)
++		file->ismapped = True;
++	else
++# else
++	if (!file->buf)
++# endif
++#endif
++	{
++		file->buf = mmalloc( flen + 1 );
++		lseek( fd, 0, SEEK_SET );
++		if (read( fd, file->buf, flen ) != flen) {
++			free( file->buf );
++			close( fd );
++			fprintf( stderr, "Cannot read file\n" );
++			return False; /* maybe better abort? */
++		}
++	}
++	file->eof = file->buf + flen;
++	close( fd );
++	return True;
++}
++
++#ifdef WANT_CLOSE
++static void
++freeBuf( File *file )
++{
++# ifdef HAVE_MMAP
++	if (file->ismapped)
++		munmap( file->buf, file->eof - file->buf );
++	else
++# endif
++		free( file->buf );
++}
++#endif
++
++static int
++isTrue( const char *val )
++{
++	return !strcmp( val, "true" ) ||
++	       !strcmp( val, "yes" ) ||
++	       !strcmp( val, "on" ) ||
++	       atoi( val );
++}
++
++
++static int
++mkpdirs( const char *name, const char *what )
++{
++	char *mfname = mstrdup( name );
++	int i;
++	struct stat st;
++
++	for (i = 1; mfname[i]; i++)
++		if (mfname[i] == '/') {
++			mfname[i] = 0;
++			if (stat( mfname, &st )) {
++				if (mkdir( mfname, 0755 )) {
++					fprintf( stderr, "Cannot create parent %s of %s directory %s: %s\n",
++					         mfname, what, name, strerror( errno ) );
++					free( mfname );
++					return False;
++				}
++				chmod( mfname, 0755 );
++			}
++			mfname[i] = '/';
++		}
++	free( mfname );
++	return True;
++}
++
++static int
++mkdirp( const char *name, int mode, const char *what, int existok )
++{
++	struct stat st;
++
++	if (stat( name, &st )) {
++		mkpdirs( name, what );
++		if (mkdir( name, mode )) {
++			fprintf( stderr, "Cannot create %s directory %s: %s\n",
++			         what, name, strerror( errno ) );
++			return False;
++		}
++		chmod( name, mode );
++		return True;
++	}
++	return existok;
++}
++
++
++static void
++displace( const char *fn )
++{
++	if (!no_backup) {
++		char bn[PATH_MAX + 4];
++		sprintf( bn, "%s.bak", fn ); /* won't overflow if only existing paths are passed */
++		rename( fn, bn );
++	} else
++		unlink( fn );
++}
++
++
++static char *
++locate( const char *exe )
++{
++	int len;
++	char *path, *pathe, *name, *thenam, nambuf[PATH_MAX+1];
++
++	if (!(path = getenv( "PATH" )))
++		return 0;
++	len = strlen( exe );
++	name = nambuf + PATH_MAX - len;
++	memcpy( name, exe, len + 1 );
++	*--name = '/';
++	do {
++		if (!(pathe = strchr( path, ':' )))
++			pathe = path + strlen( path );
++		len = pathe - path;
++		if (len && !(len == 1 && *path == '.')) {
++			thenam = name - len;
++			if (thenam >= nambuf) {
++				memcpy( thenam, path, len );
++				if (!access( thenam, X_OK ))
++					return mstrdup( thenam );
++			}
++		}
++		path = pathe;
++	} while (*path++ != '\0');
++	return 0;
++}
++
++
++/*
++ * target data to be written to kdmrc
++ */
++
++typedef struct Entry {
++	struct Entry *next;
++	struct Ent *spec;
++	const char *value;
++	int active:1;
++	int written:1;
++} Entry;
++
++typedef struct Section {
++	struct Section *next;
++	struct Sect *spec;
++	const char *name;
++	const char *comment;
++	Entry *ents;
++} Section;
++
++static Section *config; /* the kdmrc data to be written */
++
++/*
++ * Specification of the (currently possible) kdmrc entries
++ */
++
++typedef struct Ent {
++	const char *key;
++	int prio;
++	void (*func)( Entry *ce, Section *cs );
++	const char *comment;
++} Ent;
++
++typedef struct Sect {
++	const char *name;
++	Ent *ents;
++	int nents;
++} Sect;
++
++static Sect *findSect( const char *name );
++static Ent *findEnt( Sect *sect, const char *key );
++
++/*
++ * Functions to manipulate the current kdmrc data
++ */
++
++static const char *
++getFqVal( const char *sect, const char *key, const char *defval )
++{
++	Section *cs;
++	Entry *ce;
++
++	for (cs = config; cs; cs = cs->next)
++		if (!strcmp( cs->name, sect )) {
++			for (ce = cs->ents; ce; ce = ce->next)
++				if (!strcmp( ce->spec->key, key )) {
++					if (ce->active && ce->written)
++						return ce->value;
++					break;
++				}
++			break;
++		}
++	return defval;
++}
++
++static void
++putFqVal( const char *sect, const char *key, const char *value )
++{
++	Section *cs, **csp;
++	Entry *ce, **cep;
++
++	if (!value)
++		return;
++
++	for (csp = &config; (cs = *csp); csp = &(cs->next))
++		if (!strcmp( sect, cs->name ))
++			goto havesec;
++	cs = mcalloc( sizeof(*cs) );
++	ASPrintf( (char **)&cs->name, "%s", sect );
++	cs->spec = findSect( sect );
++	*csp = cs;
++  havesec:
++
++	for (cep = &(cs->ents); (ce = *cep); cep = &(ce->next))
++		if (!strcmp( key, ce->spec->key ))
++			goto haveent;
++	ce = mcalloc( sizeof(*ce) );
++	ce->spec = findEnt( cs->spec, key );
++	*cep = ce;
++  haveent:
++	ASPrintf( (char **)&ce->value, "%s", value );
++	ce->written = ce->active = True;
++}
++
++static const char *csect;
++
++#define setSect(se) csect = se
++
++static void
++putVal( const char *key, const char *value )
++{
++	putFqVal( csect, key, value );
++}
++
++
++static void
++writeKdmrc( FILE *f )
++{
++	Section *cs;
++	Entry *ce;
++	StrList *sl = 0, *sp;
++	const char *cmt;
++
++	putFqVal( "General", "ConfigVersion", RCVERSTR );
++	for (cs = config; cs; cs = cs->next) {
++		fprintf( f, "%s[%s]\n",
++		         cs->comment ? cs->comment : "\n", cs->name );
++		for (ce = cs->ents; ce; ce = ce->next) {
++			if (ce->spec->comment) {
++				cmt = ce->spec->comment;
++				for (sp = sl; sp; sp = sp->next)
++					if (sp->str == cmt) {
++						cmt = "# See above\n";
++						goto havit;
++					}
++				if (!(sp = malloc( sizeof(*sp) )))
++					fprintf( stderr, "Warning: Out of memory\n" );
++				else {
++					sp->str = cmt;
++					sp->next = sl; sl = sp;
++				}
++			} else
++				cmt = "";
++		  havit:
++			fprintf( f, "%s%s%s=%s\n",
++			         cmt, ce->active ? "" : "#", ce->spec->key, ce->value );
++		}
++	}
++}
++
++
++/*
++ * defaults
++ */
++#ifdef XDMCP
++static const char def_xaccess[] =
++"# Xaccess - Access control file for XDMCP connections\n"
++"#\n"
++"# To control Direct and Broadcast access:\n"
++"#\n"
++"#	pattern\n"
++"#\n"
++"# To control Indirect queries:\n"
++"#\n"
++"#	pattern		list of hostnames and/or macros ...\n"
++"#\n"
++"# To use the chooser:\n"
++"#\n"
++"#	pattern		CHOOSER BROADCAST\n"
++"#\n"
++"# or\n"
++"#\n"
++"#	pattern		CHOOSER list of hostnames and/or macros ...\n"
++"#\n"
++"# To define macros:\n"
++"#\n"
++"#	%name		list of hosts ...\n"
++"#\n"
++"# The first form tells xdm which displays to respond to itself.\n"
++"# The second form tells xdm to forward indirect queries from hosts matching\n"
++"# the specified pattern to the indicated list of hosts.\n"
++"# The third form tells xdm to handle indirect queries using the chooser;\n"
++"# the chooser is directed to send its own queries out via the broadcast\n"
++"# address and display the results on the terminal.\n"
++"# The fourth form is similar to the third, except instead of using the\n"
++"# broadcast address, it sends DirectQuerys to each of the hosts in the list\n"
++"#\n"
++"# In all cases, xdm uses the first entry which matches the terminal;\n"
++"# for IndirectQuery messages only entries with right hand sides can\n"
++"# match, for Direct and Broadcast Query messages, only entries without\n"
++"# right hand sides can match.\n"
++"#\n"
++"\n"
++"*					#any host can get a login window\n"
++"\n"
++"#\n"
++"# To hardwire a specific terminal to a specific host, you can\n"
++"# leave the terminal sending indirect queries to this host, and\n"
++"# use an entry of the form:\n"
++"#\n"
++"\n"
++"#terminal-a	host-a\n"
++"\n"
++"\n"
++"#\n"
++"# The nicest way to run the chooser is to just ask it to broadcast\n"
++"# requests to the network - that way new hosts show up automatically.\n"
++"# Sometimes, however, the chooser cannot figure out how to broadcast,\n"
++"# so this may not work in all environments.\n"
++"#\n"
++"\n"
++"*		CHOOSER BROADCAST	#any indirect host can get a chooser\n"
++"\n"
++"#\n"
++"# If you would prefer to configure the set of hosts each terminal sees,\n"
++"# then just uncomment these lines (and comment the CHOOSER line above)\n"
++"# and edit the %hostlist line as appropriate\n"
++"#\n"
++"\n"
++"#%hostlist	host-a host-b\n"
++"\n"
++"#*		CHOOSER %hostlist	#\n";
++#endif
++
++#ifdef XDMCP
++static const char def_willing[] =
++"#! /bin/sh\n"
++"# The output of this script is displayed in the chooser window\n"
++"# (instead of \"Willing to manage\").\n"
++"\n"
++"load=`uptime|sed -e 's/^.*load[^0-9]*//'`\n"
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/kde4-kdebase-workspace-kdmconfig.patch?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list