-
Notifications
You must be signed in to change notification settings - Fork 12
/
libvirt-0.9.2-mingw.patch
149 lines (137 loc) · 5.04 KB
/
libvirt-0.9.2-mingw.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--- a/python/Makefile.am 2010-05-26 22:09:50 +0000
+++ b/python/Makefile.am 2010-09-10 20:26:24 +0000
@@ -41,9 +41,9 @@
libvirtmod_la_CFLAGS = $(WARN_PYTHON_CFLAGS)
libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
- $(CYGWIN_EXTRA_LDFLAGS)
+ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS) -L/python/libs
libvirtmod_la_LIBADD = $(mylibs) \
- $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)
+ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) -lpython26
GENERATE = generator.py
API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml
diff -ur a/python/Makefile.in b/python/Makefile.in
--- a/python/Makefile.in 2010-09-07 17:46:28 +0000
+++ b/python/Makefile.in 2010-09-10 21:04:52 +0000
@@ -1118,10 +1118,10 @@
# need extra flags here
@WITH_PYTHON_TRUE@libvirtmod_la_CFLAGS = $(WARN_PYTHON_CFLAGS)
@WITH_PYTHON_TRUE@libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
-@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LDFLAGS)
+@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS) -L/python/libs
@WITH_PYTHON_TRUE@libvirtmod_la_LIBADD = $(mylibs) \
-@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)
+@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) -lpython26
@WITH_PYTHON_TRUE@GENERATE = generator.py
@WITH_PYTHON_TRUE@API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml
Make the remote driver use TLS certificates from %APPDATA%\libvirt\pki\ instead of /etc/pki/
--- a/src/remote/remote_driver.c 2010-11-11 17:25:02 +0000
+++ b/src/remote/remote_driver.c 2010-11-20 12:04:52 +0000
@@ -276,6 +276,70 @@
static int initialize_gnutls(void);
static gnutls_session_t negotiate_gnutls_on_connection (virConnectPtr conn, struct private_data *priv, int no_verify);
+#ifdef WIN32
+
+static char *remoteWin32CertPaths[5];
+
+static int
+remoteInitCertPaths(void)
+{
+ const char *appdata = getenv("APPDATA");
+
+ if (appdata == NULL || *appdata == '\0') {
+ appdata = "C:";
+
+ VIR_WARN("APPDATA not set, falling back to '%s'", appdata);
+ }
+
+ if (virAsprintf(&remoteWin32CertPaths[0],
+ "%s\\libvirt\\pki\\CA\\cacert.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[1],
+ "%s\\libvirt\\pki\\libvirt\\private\\clientkey.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[2],
+ "%s\\libvirt\\pki\\libvirt\\clientcert.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[3],
+ "%s\\libvirt\\pki\\libvirt\\private\\serverkey.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[4],
+ "%s\\libvirt\\pki\\libvirt\\servercert.pem", appdata) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ return 0;
+}
+
+static const char *
+remoteCACertPath(void)
+{
+ return remoteWin32CertPaths[0];
+}
+
+static const char *
+remoteClientKeyPath(void)
+{
+ return remoteWin32CertPaths[1];
+}
+
+static const char *
+remoteClientCertPath(void)
+{
+ return remoteWin32CertPaths[2];
+}
+
+static const char *
+remoteServerKeyPath(void)
+{
+ return remoteWin32CertPaths[3];
+}
+
+static const char *
+remoteServerCertPath(void)
+{
+ return remoteWin32CertPaths[4];
+}
+
+#endif /* WIN32 */
+
#ifdef WITH_LIBVIRTD
static int
remoteStartup(int privileged ATTRIBUTE_UNUSED)
@@ -10881,6 +10971,10 @@
int
remoteRegister (void)
{
+#ifdef WIN32
+ if (remoteInitCertPaths()) return -1;
+#endif
+
if (virRegisterDriver (&remote_driver) == -1) return -1;
if (virRegisterNetworkDriver (&network_driver) == -1) return -1;
if (virRegisterInterfaceDriver (&interface_driver) == -1) return -1;
--- a/src/remote/remote_driver.h 2010-11-17 17:25:02 +0000
+++ b/src/remote/remote_driver.h 2010-11-18 08:24:54 +0000
@@ -41,12 +41,19 @@
# define LIBVIRTD_CONFIGURATION_FILE SYSCONFDIR "/libvirtd.conf"
/* Defaults for PKI directory. */
-# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
-# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
-# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
-# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
-# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem"
-# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem"
-
+# ifndef WIN32
+# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
+# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
+# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
+# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
+# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem"
+# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem"
+# else
+# define LIBVIRT_CACERT remoteCACertPath()
+# define LIBVIRT_CLIENTKEY remoteClientKeyPath()
+# define LIBVIRT_CLIENTCERT remoteClientCertPath()
+# define LIBVIRT_SERVERKEY remoteServerKeyPath()
+# define LIBVIRT_SERVERCERT remoteServerCertPath()
+# endif
#endif /* __VIR_REMOTE_INTERNAL_H__ */