1 --- app.cpp.orig	2013-10-01 18:38:05.000000000 -0400
2 +++ app.cpp	2015-03-08 14:34:54.992147000 -0400
3 @@ -14,6 +14,7 @@
4  #include <unistd.h>
5  #include <fcntl.h>
6  #include <stdint.h>
7 +#include <login_cap.h>
8  #include <cstring>
9  #include <cstdio>
10  #include <iostream>
11 @@ -32,6 +33,20 @@
12 
13  using namespace std;
14 
15 +static const int LOGIN_CAP_VAR_COUNT = 4;
16 +static const char* LOGIN_CAP_VARS[] = {
17 +	"lang",
18 +	"charset",
19 +	"timezone",
20 +	"manpath",
21 +};
22 +static const char* LOGIN_CAP_ENVS[] = {
23 +	"LANG",
24 +	"MM_CHARSET",
25 +	"TZ",
26 +	"MANPATH",
27 +};
28 +
29  #ifdef USE_PAM
30  #include <string>
31 
32 @@ -123,6 +138,22 @@
33  	signal(sig, User1Signal);
34  }
35 
36 +static void AddToEnv(char*** curr_env, const char *name, const char *value) {
37 +	int n;
38 +	for (n = 0; (*curr_env)[n] != NULL; n++) ;
39 +	n++;
40 +	char** new_env = static_cast<char**>(malloc(sizeof(char*) * (n + 1)));
41 +	memcpy(new_env, *curr_env, sizeof(char*) * n);
42 +	char* entry = static_cast<char*>(malloc(strlen(name) + strlen(value) + 2));
43 +	strcpy(entry, name);
44 +	strcat(entry, "=");
45 +	strcat(entry, value);
46 +	new_env[n-1] = entry;
47 +	new_env[n] = NULL;
48 +	free(*curr_env);
49 +	*curr_env = new_env;
50 +}
51 +
52  #ifdef USE_PAM
53  App::App(int argc, char** argv)
54    : pam(conv, static_cast<void*>(&LoginPanel)),
55 @@ -596,8 +627,8 @@
56 
57  		n++;
58 
59 -		child_env = static_cast<char**>(malloc(sizeof(char*)*n));
60 -		memcpy(child_env, old_env, sizeof(char*)*n+1);
61 +		child_env = static_cast<char**>(malloc(sizeof(char*)*(n+1)));
62 +		memcpy(child_env, old_env, sizeof(char*)*n);
63  		child_env[n - 1] = StrConcat("XDG_SESSION_COOKIE=", ck.get_xdg_session_cookie());
64  		child_env[n] = NULL;
65  # endif /* USE_CONSOLEKIT */
66 @@ -627,6 +658,17 @@
67 
68  #endif
69 
70 +		login_cap_t *lc = login_getpwclass(pw);
71 +		if (lc != NULL) {
72 +			for (int i = 0; i < LOGIN_CAP_VAR_COUNT; i++) {
73 +				const char *value = login_getcapstr(lc, LOGIN_CAP_VARS[i], NULL, NULL);
74 +				if (value != NULL) {
75 +					AddToEnv(&child_env, LOGIN_CAP_ENVS[i], value);
76 +				}
77 +			}
78 +			login_close(lc);
79 +		}
80 +
81  		/* Login process starts here */
82  		SwitchUser Su(pw, cfg, DisplayName, child_env);
83  		string session = LoginPanel->getSession();
84 @@ -941,7 +983,7 @@
85  	}
86 
87  	if (!hasVtSet && daemonmode) {
88 -		server[argc++] = (char*)"vt07";
89 +		server[argc++] = (char*)"vt09";
90  	}
91  	server[argc] = NULL;
92 
93