Merge lp:~ssalley/ubuntu/natty/likewise-open/likewise-open-fix-724038-2 into lp:ubuntu/natty/likewise-open

Proposed by Scott Salley
Status: Superseded
Proposed branch: lp:~ssalley/ubuntu/natty/likewise-open/likewise-open-fix-724038-2
Merge into: lp:ubuntu/natty/likewise-open
Diff against target: 4799 lines (+4750/-3)
5 files modified
debian/changelog (+8/-0)
debian/likewise-open.install (+5/-0)
debian/patches/add-missing-lwconfig.diff (+4733/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-3)
To merge this branch: bzr merge lp:~ssalley/ubuntu/natty/likewise-open/likewise-open-fix-724038-2
Reviewer Review Type Date Requested Status
Dave Walker (community) Needs Fixing
Ubuntu branches Pending
Review via email: mp+51201@code.launchpad.net

This proposal has been superseded by a proposal from 2011-03-04.

Description of the change

This merges the tool lwconfig from upstream. We originally forgot to export lwconfig from our internal subversion repository to the external git mirror. lwconfig consists of a binary (/usr/bin/lwconfig) and a recipe file (/var/lib/likewise-open/lwconfig.xml).

Impact:
This tool makes configuring likewise-open easier for users by encapsulating a series of actions in a single command and is frequently leveraged by the documentation.

This tool does not interact with the authentication system and will not open security holes.

Note that I originally got this in before the freeze deadline but was asked to redo some work (see https://code.launchpad.net/~ssalley/ubuntu/natty/likewise-open/likewise-open-fix-724038) and didn't know of a nice way to do that to a branch I've already uploaded/asked-for-review.

To post a comment you must log in.
Revision history for this message
Dave Walker (davewalker) wrote :

Hi,

Thanks for working on this.

6.0.0.53010-4 has just been uploaded with:

  * fixed resource paths in domainjoin-gui by updating
    debian/patches/domainjoin-gui-path.diff and re-enabling it in
    debian/patches/series. (LP: #727051)

Can i ask you to rebase this branch against rev 22 of lp:ubuntu/likewise-open, with the debian/changelog version bumped +1?

If you have any questions please feel free to ask.

Thanks!

review: Needs Fixing
Revision history for this message
Scott Salley (ssalley) wrote :

Will do against rev 23 which is now the latest. Is there a point at which a proposed merge branch should be deleted or should it hang around forever?

Revision history for this message
Scott Salley (ssalley) wrote :

The previous revision is now "6.0.53010-4ubuntu1". What should I label my change -- 6.0.53010-5 or something else?

Revision history for this message
Colin Watson (cjwatson) wrote :

6.0.53010-4ubuntu2.

Unmerged revisions

22. By Scott Salley

* added lwconfig from upstream that was mistakenly left out. (LP: #724038)
  - added debian/patches/add-missing-lwconfig.diff based on upstream
  - updated debian/rules, debian/likewise-open.install for lwconfig

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-02-10 11:15:29 +0000
3+++ debian/changelog 2011-02-24 20:14:14 +0000
4@@ -1,3 +1,11 @@
5+likewise-open (6.0.0.53010-4) natty; urgency=low
6+
7+ * added lwconfig from upstream that was mistakenly left out. (LP: #724038)
8+ - added debian/patches/add-missing-lwconfig.diff based on upstream
9+ - updated debian/rules, debian/likewise-open.install for lwconfig
10+
11+ -- Scott Salley <ssalley@likewise.com> Thu, 24 Feb 2011 11:01:17 -0800
12+
13 likewise-open (6.0.0.53010-3) natty; urgency=low
14
15 * LP: #716615
16
17=== modified file 'debian/likewise-open.install'
18--- debian/likewise-open.install 2010-11-22 12:06:00 +0000
19+++ debian/likewise-open.install 2011-02-24 20:14:14 +0000
20@@ -185,3 +185,8 @@
21
22 # apparmor HOMEDIRS tunable
23 etc/apparmor.d/tunables/home.d/likewise-open
24+
25+# lwconfig
26+usr/bin/lwconfig
27+var/lib/likewise-open/lwconfig.xml
28+
29
30=== added file 'debian/patches/add-missing-lwconfig.diff'
31--- debian/patches/add-missing-lwconfig.diff 1970-01-01 00:00:00 +0000
32+++ debian/patches/add-missing-lwconfig.diff 2011-02-24 20:14:14 +0000
33@@ -0,0 +1,4733 @@
34+diff -Nurb likewise-open-6.0.0.53010.old/git-build/build/components/lwconfig.comp likewise-open-6.0.0.53010/git-build/build/components/lwconfig.comp
35+--- likewise-open-6.0.0.53010.old/git-build/build/components/lwconfig.comp 1969-12-31 16:00:00.000000000 -0800
36++++ likewise-open-6.0.0.53010/git-build/build/components/lwconfig.comp 2011-02-24 10:56:55.000000000 -0800
37+@@ -0,0 +1,82 @@
38++#!/bin/sh
39++
40++COMP_NAME="lwconfig"
41++COMP_SOURCES="${BUILD_ROOT}/${COMP_NAME}"
42++
43++
44++function _setup_build_env
45++{
46++ set_compiler_env
47++
48++ cd ${COMP_SOURCES}/.
49++ exit_on_error $?
50++
51++ CPPFLAGS="${_cppflags} -I/usr/include/libxml2"
52++ CFLAGS="${_cflags}"
53++ LDFLAGS="${_ldflags}"
54++
55++ export PATH CPPFLAGS LDFLAGS CFLAGS CC
56++}
57++
58++function component_configure
59++{
60++ _setup_build_env
61++
62++ run_autogen ${COMP_SOURCES}
63++ exit_on_error $?
64++
65++ ./configure \
66++ --prefix=${PREFIXDIR} \
67++ --libdir=${PREFIXDIR}/${_lib} \
68++ --localstatedir=${LOCALSTATEDIR} \
69++ --sysconfdir=${SYSCONFDIR}
70++ exit_on_error $?
71++}
72++
73++function component_build
74++{
75++ _setup_build_env
76++
77++ ${MAKE} ${_mflags} all
78++}
79++
80++function component_install
81++{
82++ _setup_build_env
83++
84++ local INSTALL_ROOT="${STAGE_COMP_DIR}/${COMP_NAME}"
85++
86++ [ "$INSTALL_ROOT" != "/" ] && rm -rf $INSTALL_ROOT
87++ mkdir -p ${INSTALL_ROOT}
88++ mkdir -p ${STAGE_INSTALL_DIR}
89++
90++ ${MAKE} DESTDIR=${INSTALL_ROOT} install
91++
92++ rsync -a ${INSTALL_ROOT}/ ${STAGE_INSTALL_DIR}/
93++
94++ libtool_rewrite_staging
95++}
96++
97++function component_populate
98++{
99++ local INSTALL_ROOT="${STAGE_COMP_DIR}/${COMP_NAME}"
100++ local INSTALL_PREFIX_DIR="${INSTALL_ROOT}/${PREFIXDIR}"
101++ local STAGING_PREFIX_DIR="${STAGE_INSTALL_DIR}/${PREFIXDIR}"
102++ local STAGING_SYSCONF_DIR="${STAGE_INSTALL_DIR}/${SYSCONFDIR}"
103++
104++ local POPULATE_DIR="$1"
105++ local EXCLUDE_FILE="${POPULATE_DIR}/../exclude.files"
106++
107++ if [ -z "${POPULATE_DIR}" ] || [ ! -d "${POPULATE_DIR}" ]; then
108++ echo "Non-existent or invalid populate dircetory given: ${POPULATE_DIR}"
109++ return 1
110++ fi
111++
112++ cat <<EOF > ${EXCLUDE_FILE}
113++share
114++*.a
115++*.la
116++EOF
117++
118++ rsync -a --exclude-from=${EXCLUDE_FILE} ${INSTALL_ROOT}/ ${POPULATE_DIR}/
119++}
120+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/autogen.sh likewise-open-6.0.0.53010/lwconfig/autogen.sh
121+--- likewise-open-6.0.0.53010.old/lwconfig/autogen.sh 1969-12-31 16:00:00.000000000 -0800
122++++ likewise-open-6.0.0.53010/lwconfig/autogen.sh 2011-01-17 11:51:56.000000000 -0800
123+@@ -0,0 +1,2 @@
124++#!/bin/sh
125++autoreconf -fi
126+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/configure.ac likewise-open-6.0.0.53010/lwconfig/configure.ac
127+--- likewise-open-6.0.0.53010.old/lwconfig/configure.ac 1969-12-31 16:00:00.000000000 -0800
128++++ likewise-open-6.0.0.53010/lwconfig/configure.ac 2011-01-17 11:51:56.000000000 -0800
129+@@ -0,0 +1,187 @@
130++AC_PREREQ(2.59)
131++AC_INIT(lwconfig, 5.4, support@likewise.com)
132++AC_CANONICAL_TARGET
133++AM_INIT_AUTOMAKE([-Wall -Werror foreign])
134++AC_CONFIG_HEADERS([include/config.h])
135++AC_CONFIG_MACRO_DIR(m4])
136++
137++AM_CPPFLAGS=""
138++AM_CFLAGS=""
139++AM_LDFLAGS=""
140++
141++default_skeldirs="/etc/skel"
142++default_homedir_prefix="/home"
143++enable_nss_enum_default="false"
144++
145++case "$host_os:$host_cpu" in
146++ linux*:*)
147++ AC_DEFINE([__LWI_LINUX___], [], [Defined if OS is Linux])
148++ ;;
149++ solaris*:*)
150++ AC_DEFINE([__LWI_SOLARIS__], [], [Define if OS is Solaris])
151++ ;;
152++ darwin*:*)
153++ default_skeldirs="System/LibraryUser Template/Non_localized, /System/Library/User Template/English.lproj"
154++ default_homedir_prefix="/Users"
155++ enable_nss_enum_default="true"
156++ AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin])
157++ ;;
158++ freebsd*:*)
159++ AC_DEFINE([__LWI_FREEBSD__], [], [Define if OS is FreeBSD])
160++ ;;
161++ hpux*:hppa*)
162++ AC_DEFINE([__LWI_HP_UX__], [], [Define if OS is HP-UX])
163++ AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [Define on HP-UX])
164++ ;;
165++ hpux*:ia64*)
166++ AC_DEFINE([__LWI_HP_UX__], [], [Define if OS is HP-UX])
167++ AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [Define on HP-UX])
168++ ;;
169++ aix*:*)
170++ AC_DEFINE([__LWI_AIX__], [], [Define if OS is AIX])
171++ AC_DEFINE([_LINUX_SOURCE_COMPAT], [], [Enable Linux source compatibility on AIX])
172++ ;;
173++esac
174++
175++AC_SUBST(default_skeldirs)
176++AC_SUBST(default_homedir_prefix)
177++AC_SUBST(enable_nss_enum_default)
178++
179++# debugging
180++
181++AC_ARG_ENABLE([debug],
182++ [AC_HELP_STRING([--enable-debug], [enable debugging (default: disabled)])],
183++ [
184++ if test x"$enableval" = x"yes"
185++ then
186++ AM_CFLAGS="$AM_CFLAGS -g -O0"
187++ AM_CPPFLAGS="$AM_CPPFLAGS -DDEBUG"
188++ fi
189++ ])
190++
191++AC_ARG_WITH([lwadvapi],
192++ [AC_HELP_STRING([--with-lwadvapi=<dir>], [use lwadvapi located in prefix <dir>])],
193++ [
194++ LWADVAPI_INCLUDES="-I$withval/include"
195++ LWADVAPI_LDFLAGS="-L$withval/lib"
196++ ])
197++AC_ARG_WITH([lwadvapi-includes],
198++ [AC_HELP_STRING([--with-lwadvapi-includes=<dir>], [use lwadvapi includes located in <dir>])],
199++ [
200++ LWADVAPI_INCLUDES="-I$withval"
201++ ])
202++AC_ARG_WITH([lwadvapi-libs],
203++ [AC_HELP_STRING([--with-lwadvapi-libs=<dir>], [use lwadvapi libs located in <dir>])],
204++ [
205++ LWADVAPI_LDFLAGS="-L$withval"
206++ ])
207++
208++LWADVAPI_LIBS="-llwadvapi"
209++LWADVAPI_NOTHR_LIBS="-llwadvapi_nothr"
210++
211++AC_SUBST(LWADVAPI_INCLUDES)
212++AC_SUBST(LWADVAPI_LDFLAGS)
213++AC_SUBST(LWADVAPI_LIBS)
214++AC_SUBST(LWADVAPI_NOTHR_LIBS)
215++
216++# lwbase
217++
218++AC_ARG_WITH([lwbase],
219++ [AC_HELP_STRING([--with-lwbase=<dir>], [use lwbase located in prefix <dir>])],
220++ [
221++ LWBASE_INCLUDES="-I$withval/include"
222++ LWBASE_LDFLAGS="-L$withval/lib"
223++ ])
224++
225++AC_ARG_WITH([lwbase-includes],
226++ [AC_HELP_STRING([--with-lwbase-includes=<dir>], [use lwbase includes located in <dir>])],
227++ [
228++ LWBASE_INCLUDES="-I$withval"
229++ ])
230++
231++AC_ARG_WITH([lwbase-libs],
232++ [AC_HELP_STRING([--with-lwbase-libs=<dir>], [use lwbase libs located in <dir>])],
233++ [
234++ LWBASE_LDFLAGS="-L$withval"
235++ ])
236++LWBASE_LIBS=-llwbase
237++
238++AC_SUBST(LWBASE_INCLUDES)
239++AC_SUBST(LWBASE_LDFLAGS)
240++AC_SUBST(LWBASE_LIBS)
241++
242++
243++# lwreg
244++
245++AC_ARG_WITH([lwreg],
246++ [AC_HELP_STRING([--with-lwreg=<dir>], [use lwreg located in prefix <dir>])],
247++ [
248++ LWREG_INCLUDES="-I$withval/include"
249++ LWREG_LDFLAGS="-L$withval/lib"
250++ ])
251++
252++AC_ARG_WITH([lwreg-includes],
253++ [AC_HELP_STRING([--with-lwreg-includes=<dir>], [use lwreg includes located in <dir>])],
254++ [
255++ LWREG_INCLUDES="-I$withval"
256++ ])
257++
258++AC_ARG_WITH([lwreg-libs],
259++ [AC_HELP_STRING([--with-lwreg-libs=<dir>], [use lwreg libs located in <dir>])],
260++ [
261++ LWREG_LDFLAGS="-L$withval"
262++ ])
263++
264++LWREG_LIBS=-lregclient
265++
266++AC_SUBST(LWREG_INCLUDES)
267++AC_SUBST(LWREG_LDFLAGS)
268++AC_SUBST(LWREG_LIBS)
269++
270++XML2_INCLUDES=""
271++XML2_LDFLAGS=""
272++XML2_LIBS="-lxml2"
273++AC_SUBST(XML2_INCLUDES)
274++AC_SUBST(XML2_LDFLAGS)
275++AC_SUBST(XML2_LIBS)
276++
277++if test x"$localstatedir" = x"/var"; then
278++ lwconfigdir="$localstatedir/lib/likewise"
279++else
280++ lwconfigdir="$localstatedir"
281++fi
282++AC_SUBST(lwconfigdir)
283++AC_DEFINE_UNQUOTED(LWCONFIG_XML, "${lwconfigdir}/lwconfig.xml", "Path to lwconfig.xml")
284++
285++# Checks for library functions
286++AC_FUNC_MALLOC
287++AC_CHECK_FUNCS([strndup strncasecmp strtoul strtoll __strtoll])
288++
289++# Checks for header files.
290++AC_CHECK_HEADERS([string.h strings.h sys/types.h sys/varargs.h])
291++
292++CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_GNU_SOURCE"
293++
294++AM_CPPFLAGS="$AM_CPPFLAGS -I${top_srcdir}/include"
295++AM_CFLAGS="$AM_CFLAGS -Wall -Werror -fno-strict-aliasing"
296++
297++AC_SUBST(AM_CPPFLAGS)
298++AC_SUBST(AM_CFLAGS)
299++AC_SUBST(AM_LDFLAGS)
300++
301++# Checks for programs.
302++AC_PROG_CC
303++AC_PROG_LIBTOOL
304++
305++# Checks for typedefs, structures, and compiler characteristics.
306++AC_C_BIGENDIAN
307++
308++# Checks for library functions.
309++AC_HEADER_STDC
310++
311++AC_CONFIG_FILES([Makefile
312++ etc/Makefile
313++ etc/lwconfig.xml
314++ src/Makefile])
315++
316++AC_OUTPUT
317+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/COPYING-GPL likewise-open-6.0.0.53010/lwconfig/COPYING-GPL
318+--- likewise-open-6.0.0.53010.old/lwconfig/COPYING-GPL 1969-12-31 16:00:00.000000000 -0800
319++++ likewise-open-6.0.0.53010/lwconfig/COPYING-GPL 2011-01-17 11:51:56.000000000 -0800
320+@@ -0,0 +1,339 @@
321++ GNU GENERAL PUBLIC LICENSE
322++ Version 2, June 1991
323++
324++ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
325++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
326++ Everyone is permitted to copy and distribute verbatim copies
327++ of this license document, but changing it is not allowed.
328++
329++ Preamble
330++
331++ The licenses for most software are designed to take away your
332++freedom to share and change it. By contrast, the GNU General Public
333++License is intended to guarantee your freedom to share and change free
334++software--to make sure the software is free for all its users. This
335++General Public License applies to most of the Free Software
336++Foundation's software and to any other program whose authors commit to
337++using it. (Some other Free Software Foundation software is covered by
338++the GNU Lesser General Public License instead.) You can apply it to
339++your programs, too.
340++
341++ When we speak of free software, we are referring to freedom, not
342++price. Our General Public Licenses are designed to make sure that you
343++have the freedom to distribute copies of free software (and charge for
344++this service if you wish), that you receive source code or can get it
345++if you want it, that you can change the software or use pieces of it
346++in new free programs; and that you know you can do these things.
347++
348++ To protect your rights, we need to make restrictions that forbid
349++anyone to deny you these rights or to ask you to surrender the rights.
350++These restrictions translate to certain responsibilities for you if you
351++distribute copies of the software, or if you modify it.
352++
353++ For example, if you distribute copies of such a program, whether
354++gratis or for a fee, you must give the recipients all the rights that
355++you have. You must make sure that they, too, receive or can get the
356++source code. And you must show them these terms so they know their
357++rights.
358++
359++ We protect your rights with two steps: (1) copyright the software, and
360++(2) offer you this license which gives you legal permission to copy,
361++distribute and/or modify the software.
362++
363++ Also, for each author's protection and ours, we want to make certain
364++that everyone understands that there is no warranty for this free
365++software. If the software is modified by someone else and passed on, we
366++want its recipients to know that what they have is not the original, so
367++that any problems introduced by others will not reflect on the original
368++authors' reputations.
369++
370++ Finally, any free program is threatened constantly by software
371++patents. We wish to avoid the danger that redistributors of a free
372++program will individually obtain patent licenses, in effect making the
373++program proprietary. To prevent this, we have made it clear that any
374++patent must be licensed for everyone's free use or not licensed at all.
375++
376++ The precise terms and conditions for copying, distribution and
377++modification follow.
378++
379++ GNU GENERAL PUBLIC LICENSE
380++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
381++
382++ 0. This License applies to any program or other work which contains
383++a notice placed by the copyright holder saying it may be distributed
384++under the terms of this General Public License. The "Program", below,
385++refers to any such program or work, and a "work based on the Program"
386++means either the Program or any derivative work under copyright law:
387++that is to say, a work containing the Program or a portion of it,
388++either verbatim or with modifications and/or translated into another
389++language. (Hereinafter, translation is included without limitation in
390++the term "modification".) Each licensee is addressed as "you".
391++
392++Activities other than copying, distribution and modification are not
393++covered by this License; they are outside its scope. The act of
394++running the Program is not restricted, and the output from the Program
395++is covered only if its contents constitute a work based on the
396++Program (independent of having been made by running the Program).
397++Whether that is true depends on what the Program does.
398++
399++ 1. You may copy and distribute verbatim copies of the Program's
400++source code as you receive it, in any medium, provided that you
401++conspicuously and appropriately publish on each copy an appropriate
402++copyright notice and disclaimer of warranty; keep intact all the
403++notices that refer to this License and to the absence of any warranty;
404++and give any other recipients of the Program a copy of this License
405++along with the Program.
406++
407++You may charge a fee for the physical act of transferring a copy, and
408++you may at your option offer warranty protection in exchange for a fee.
409++
410++ 2. You may modify your copy or copies of the Program or any portion
411++of it, thus forming a work based on the Program, and copy and
412++distribute such modifications or work under the terms of Section 1
413++above, provided that you also meet all of these conditions:
414++
415++ a) You must cause the modified files to carry prominent notices
416++ stating that you changed the files and the date of any change.
417++
418++ b) You must cause any work that you distribute or publish, that in
419++ whole or in part contains or is derived from the Program or any
420++ part thereof, to be licensed as a whole at no charge to all third
421++ parties under the terms of this License.
422++
423++ c) If the modified program normally reads commands interactively
424++ when run, you must cause it, when started running for such
425++ interactive use in the most ordinary way, to print or display an
426++ announcement including an appropriate copyright notice and a
427++ notice that there is no warranty (or else, saying that you provide
428++ a warranty) and that users may redistribute the program under
429++ these conditions, and telling the user how to view a copy of this
430++ License. (Exception: if the Program itself is interactive but
431++ does not normally print such an announcement, your work based on
432++ the Program is not required to print an announcement.)
433++
434++These requirements apply to the modified work as a whole. If
435++identifiable sections of that work are not derived from the Program,
436++and can be reasonably considered independent and separate works in
437++themselves, then this License, and its terms, do not apply to those
438++sections when you distribute them as separate works. But when you
439++distribute the same sections as part of a whole which is a work based
440++on the Program, the distribution of the whole must be on the terms of
441++this License, whose permissions for other licensees extend to the
442++entire whole, and thus to each and every part regardless of who wrote it.
443++
444++Thus, it is not the intent of this section to claim rights or contest
445++your rights to work written entirely by you; rather, the intent is to
446++exercise the right to control the distribution of derivative or
447++collective works based on the Program.
448++
449++In addition, mere aggregation of another work not based on the Program
450++with the Program (or with a work based on the Program) on a volume of
451++a storage or distribution medium does not bring the other work under
452++the scope of this License.
453++
454++ 3. You may copy and distribute the Program (or a work based on it,
455++under Section 2) in object code or executable form under the terms of
456++Sections 1 and 2 above provided that you also do one of the following:
457++
458++ a) Accompany it with the complete corresponding machine-readable
459++ source code, which must be distributed under the terms of Sections
460++ 1 and 2 above on a medium customarily used for software interchange; or,
461++
462++ b) Accompany it with a written offer, valid for at least three
463++ years, to give any third party, for a charge no more than your
464++ cost of physically performing source distribution, a complete
465++ machine-readable copy of the corresponding source code, to be
466++ distributed under the terms of Sections 1 and 2 above on a medium
467++ customarily used for software interchange; or,
468++
469++ c) Accompany it with the information you received as to the offer
470++ to distribute corresponding source code. (This alternative is
471++ allowed only for noncommercial distribution and only if you
472++ received the program in object code or executable form with such
473++ an offer, in accord with Subsection b above.)
474++
475++The source code for a work means the preferred form of the work for
476++making modifications to it. For an executable work, complete source
477++code means all the source code for all modules it contains, plus any
478++associated interface definition files, plus the scripts used to
479++control compilation and installation of the executable. However, as a
480++special exception, the source code distributed need not include
481++anything that is normally distributed (in either source or binary
482++form) with the major components (compiler, kernel, and so on) of the
483++operating system on which the executable runs, unless that component
484++itself accompanies the executable.
485++
486++If distribution of executable or object code is made by offering
487++access to copy from a designated place, then offering equivalent
488++access to copy the source code from the same place counts as
489++distribution of the source code, even though third parties are not
490++compelled to copy the source along with the object code.
491++
492++ 4. You may not copy, modify, sublicense, or distribute the Program
493++except as expressly provided under this License. Any attempt
494++otherwise to copy, modify, sublicense or distribute the Program is
495++void, and will automatically terminate your rights under this License.
496++However, parties who have received copies, or rights, from you under
497++this License will not have their licenses terminated so long as such
498++parties remain in full compliance.
499++
500++ 5. You are not required to accept this License, since you have not
501++signed it. However, nothing else grants you permission to modify or
502++distribute the Program or its derivative works. These actions are
503++prohibited by law if you do not accept this License. Therefore, by
504++modifying or distributing the Program (or any work based on the
505++Program), you indicate your acceptance of this License to do so, and
506++all its terms and conditions for copying, distributing or modifying
507++the Program or works based on it.
508++
509++ 6. Each time you redistribute the Program (or any work based on the
510++Program), the recipient automatically receives a license from the
511++original licensor to copy, distribute or modify the Program subject to
512++these terms and conditions. You may not impose any further
513++restrictions on the recipients' exercise of the rights granted herein.
514++You are not responsible for enforcing compliance by third parties to
515++this License.
516++
517++ 7. If, as a consequence of a court judgment or allegation of patent
518++infringement or for any other reason (not limited to patent issues),
519++conditions are imposed on you (whether by court order, agreement or
520++otherwise) that contradict the conditions of this License, they do not
521++excuse you from the conditions of this License. If you cannot
522++distribute so as to satisfy simultaneously your obligations under this
523++License and any other pertinent obligations, then as a consequence you
524++may not distribute the Program at all. For example, if a patent
525++license would not permit royalty-free redistribution of the Program by
526++all those who receive copies directly or indirectly through you, then
527++the only way you could satisfy both it and this License would be to
528++refrain entirely from distribution of the Program.
529++
530++If any portion of this section is held invalid or unenforceable under
531++any particular circumstance, the balance of the section is intended to
532++apply and the section as a whole is intended to apply in other
533++circumstances.
534++
535++It is not the purpose of this section to induce you to infringe any
536++patents or other property right claims or to contest validity of any
537++such claims; this section has the sole purpose of protecting the
538++integrity of the free software distribution system, which is
539++implemented by public license practices. Many people have made
540++generous contributions to the wide range of software distributed
541++through that system in reliance on consistent application of that
542++system; it is up to the author/donor to decide if he or she is willing
543++to distribute software through any other system and a licensee cannot
544++impose that choice.
545++
546++This section is intended to make thoroughly clear what is believed to
547++be a consequence of the rest of this License.
548++
549++ 8. If the distribution and/or use of the Program is restricted in
550++certain countries either by patents or by copyrighted interfaces, the
551++original copyright holder who places the Program under this License
552++may add an explicit geographical distribution limitation excluding
553++those countries, so that distribution is permitted only in or among
554++countries not thus excluded. In such case, this License incorporates
555++the limitation as if written in the body of this License.
556++
557++ 9. The Free Software Foundation may publish revised and/or new versions
558++of the General Public License from time to time. Such new versions will
559++be similar in spirit to the present version, but may differ in detail to
560++address new problems or concerns.
561++
562++Each version is given a distinguishing version number. If the Program
563++specifies a version number of this License which applies to it and "any
564++later version", you have the option of following the terms and conditions
565++either of that version or of any later version published by the Free
566++Software Foundation. If the Program does not specify a version number of
567++this License, you may choose any version ever published by the Free Software
568++Foundation.
569++
570++ 10. If you wish to incorporate parts of the Program into other free
571++programs whose distribution conditions are different, write to the author
572++to ask for permission. For software which is copyrighted by the Free
573++Software Foundation, write to the Free Software Foundation; we sometimes
574++make exceptions for this. Our decision will be guided by the two goals
575++of preserving the free status of all derivatives of our free software and
576++of promoting the sharing and reuse of software generally.
577++
578++ NO WARRANTY
579++
580++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
581++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
582++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
583++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
584++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
585++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
586++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
587++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
588++REPAIR OR CORRECTION.
589++
590++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
591++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
592++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
593++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
594++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
595++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
596++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
597++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
598++POSSIBILITY OF SUCH DAMAGES.
599++
600++ END OF TERMS AND CONDITIONS
601++
602++ How to Apply These Terms to Your New Programs
603++
604++ If you develop a new program, and you want it to be of the greatest
605++possible use to the public, the best way to achieve this is to make it
606++free software which everyone can redistribute and change under these terms.
607++
608++ To do so, attach the following notices to the program. It is safest
609++to attach them to the start of each source file to most effectively
610++convey the exclusion of warranty; and each file should have at least
611++the "copyright" line and a pointer to where the full notice is found.
612++
613++ <one line to give the program's name and a brief idea of what it does.>
614++ Copyright (C) <year> <name of author>
615++
616++ This program is free software; you can redistribute it and/or modify
617++ it under the terms of the GNU General Public License as published by
618++ the Free Software Foundation; either version 2 of the License, or
619++ (at your option) any later version.
620++
621++ This program is distributed in the hope that it will be useful,
622++ but WITHOUT ANY WARRANTY; without even the implied warranty of
623++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
624++ GNU General Public License for more details.
625++
626++ You should have received a copy of the GNU General Public License along
627++ with this program; if not, write to the Free Software Foundation, Inc.,
628++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
629++
630++Also add information on how to contact you by electronic and paper mail.
631++
632++If the program is interactive, make it output a short notice like this
633++when it starts in an interactive mode:
634++
635++ Gnomovision version 69, Copyright (C) year name of author
636++ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
637++ This is free software, and you are welcome to redistribute it
638++ under certain conditions; type `show c' for details.
639++
640++The hypothetical commands `show w' and `show c' should show the appropriate
641++parts of the General Public License. Of course, the commands you use may
642++be called something other than `show w' and `show c'; they could even be
643++mouse-clicks or menu items--whatever suits your program.
644++
645++You should also get your employer (if you work as a programmer) or your
646++school, if any, to sign a "copyright disclaimer" for the program, if
647++necessary. Here is a sample; alter the names:
648++
649++ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
650++ `Gnomovision' (which makes passes at compilers) written by James Hacker.
651++
652++ <signature of Ty Coon>, 1 April 1989
653++ Ty Coon, President of Vice
654++
655++This General Public License does not permit incorporating your program into
656++proprietary programs. If your program is a subroutine library, you may
657++consider it more useful to permit linking proprietary applications with the
658++library. If this is what you want to do, use the GNU Lesser General
659++Public License instead of this License.
660+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/etc/lwconfig.xml.in likewise-open-6.0.0.53010/lwconfig/etc/lwconfig.xml.in
661+--- likewise-open-6.0.0.53010.old/lwconfig/etc/lwconfig.xml.in 1969-12-31 16:00:00.000000000 -0800
662++++ likewise-open-6.0.0.53010/lwconfig/etc/lwconfig.xml.in 2011-01-17 11:51:56.000000000 -0800
663+@@ -0,0 +1,721 @@
664++<?xml version="1.0" encoding="utf-8"?> <capabilities>
665++<section section="Eventlog">
666++
667++ <capability>
668++ <name>AllowDeleteTo</name>
669++ <description>List of users that can delete entries from log</description>
670++ <registry
671++ type="string"
672++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Parameters\AllowDeleteTo"
673++ gp-path="HKEY_THIS_MACHINE\Policy\Services\eventlog\Parameters\AllowDeleteTo"
674++ >
675++
676++ <description>A list of user names, group names, or SIDS separated by commas.</description>
677++ <default><value></value></default>
678++ <apply command="/opt/likewise/bin/lwsm restart eventlog" />
679++ </registry>
680++ </capability>
681++
682++ <capability>
683++ <name>AllowReadTo</name>
684++ <description>Allowed users that can read entries from log</description>
685++ <registry type="string"
686++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Parameters\AllowReadTo"
687++ gp-path="HKEY_THIS_MACHINE\Policy\Services\eventlog\Parameters\AllowReadTo">
688++ <description>A list of user names, group names, or SIDS separated by commas.</description>
689++ <default>
690++ <value></value>
691++ </default>
692++ <apply command="/opt/likewise/bin/lwsm restart eventlog" />
693++ </registry>
694++ </capability>
695++
696++ <capability>
697++ <name>AllowWriteTo</name>
698++ <description>Allowed users that can delete entries from log</description>
699++ <registry type="string"
700++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Parameters\AllowWriteTo"
701++ gp-path="HKEY_THIS_MACHINE\Policy\Services\eventlog\Parameters\AllowWriteTo" >
702++ <description>A list of user names, group names, or SIDS separated by commas.</description>
703++ <default>
704++ <value></value>
705++ </default>
706++ <apply command="/opt/likewise/bin/lwsm restart eventlog" />
707++ </registry>
708++ </capability>
709++ <capability>
710++ <name>MaxDiskUsage</name>
711++ <description>Max size in bytes of eventlog database</description>
712++ <registry type="dword"
713++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Parameters\MaxDiskUsage"
714++ gp-path="HKEY_THIS_MACHINE\Policy\Services\eventlog\Parameters\MaxDiskUsage" >
715++ <description>Size in bytes</description>
716++ <default>
717++ <value>100MB</value>
718++ </default>
719++ <accept>
720++ <range min="100" max="2147483648" />
721++ </accept>
722++ <unit suffix="B" multiplier="1" />
723++ <unit suffix="KB" multiplier="1024" />
724++ <unit suffix="MB" multiplier="1048576" />
725++ <apply command="/opt/likewise/bin/lwsm restart eventlog" />
726++ </registry>
727++ </capability>
728++ <capability>
729++ <name>MaxEventLifespan</name>
730++ <description>Maximum number of days that events are saved in eventlog</description>
731++ <registry type="dword"
732++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Parameters\MaxEventLifespan"
733++ gp-path="HKEY_THIS_MACHINE\Policy\Services\eventlog\Parameters\MaxEventLifespan" >
734++ <description>days</description>
735++ <default>
736++ <value>90</value>
737++ </default>
738++ <accept>
739++ <range min="1" max="365" />
740++ </accept>
741++ <apply command="/opt/likewise/bin/lwsm restart eventlog" />
742++ </registry>
743++ </capability>
744++ <capability>
745++ <name>MaxNumEvents</name>
746++ <description>Maximum number of events to hold in eventlog database</description>
747++ <registry type="dword"
748++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Parameters\MaxNumEvents"
749++ gp-path="HKEY_THIS_MACHINE\Policy\Services\eventlog\Parameters\MaxNumEvents" >
750++ <description>number of events</description>
751++ <default>
752++ <value>100000</value>
753++ </default>
754++ <accept>
755++ <range min="100" max="2000000" />
756++ </accept>
757++ <apply command="/opt/likewise/bin/lwsm restart eventlog" />
758++ </registry>
759++ </capability>
760++ </section>
761++<section section="Lsass">
762++ <capability>
763++ <name>DomainSeparator</name>
764++ <description>Character used to designate the domain name separator</description>
765++ <registry type="string"
766++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\DomainSeparator"
767++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\DomainSeparator" >
768++ <description>A single character this is not alphanumeric or the SpaceReplacement character.</description>
769++ <default>
770++ <value>\</value>
771++ </default>
772++ <reject>
773++ <pattern>..+</pattern>
774++ <pattern>[a-zA-Z0-9]</pattern>
775++ </reject>
776++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
777++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
778++ </registry>
779++ </capability>
780++ <capability>
781++ <name>SpaceReplacement</name>
782++ <description>Character used to designate space characters in names of objects</description>
783++ <registry type="string"
784++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\SpaceReplacement"
785++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\SpaceReplacement" >
786++ <description>A single character used in place of spaces in names of objects</description>
787++ <default>
788++ <value>^</value>
789++ </default>
790++ <reject>
791++ <pattern>..+</pattern>
792++ <pattern>[a-zA-Z0-9]</pattern>
793++ </reject>
794++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
795++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
796++ </registry>
797++ </capability>
798++ <capability>
799++ <name>EnableEventlog</name>
800++ <description>Configure lsass to log events to the event log</description>
801++ <registry type="boolean"
802++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\EnableEventLog"
803++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\EnableEventLog" >
804++ <default>
805++ <value>false</value>
806++ </default>
807++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
808++ </registry>
809++ </capability>
810++ <capability>
811++ <name>LogInvalidPasswords</name>
812++ <description>Configure lsass to log events for failed authentication attempts due to invalid passwords</description>
813++ <registry type="boolean"
814++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\LogInvalidPasswords"
815++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\LogInvalidPasswords" >
816++ <default>
817++ <value>false</value>
818++ </default>
819++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
820++ </registry>
821++ </capability>
822++</section>
823++<section section="Lsass - PAM">
824++ <capability>
825++ <name>DisplayMotd</name>
826++ <description>Display message of the day</description>
827++ <registry type="boolean"
828++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\PAM\DisplayMotd"
829++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\PAM\DisplayMotd" >
830++ <default>
831++ <value>false</value>
832++ </default>
833++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
834++ </registry>
835++ </capability>
836++ <capability>
837++ <name>PAMLogLevel</name>
838++ <description>Configure PAM lsass logging detail level</description>
839++ <registry type="string"
840++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\PAM\LogLevel"
841++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\PAM\LogLevel" >
842++ <default>
843++ <value>error</value>
844++ </default>
845++ <accept>
846++ <value>disabled</value>
847++ <value>error</value>
848++ <value>warning</value>
849++ <value>info</value>
850++ <value>verbose</value>
851++ </accept>
852++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
853++ </registry>
854++ </capability>
855++ <capability>
856++ <name>UserNotAllowedError</name>
857++ <description>Message displayed at console logon failed attempt</description>
858++ <registry type="string"
859++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\PAM\UserNotAllowedError"
860++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\PAM\UserNotAllowedError" >
861++ <description>Not allowed error</description>
862++ <default>
863++ <value>Access Denied</value>
864++ </default>
865++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
866++ </registry>
867++ </capability>
868++</section>
869++<section section="Lsass - Active Directory provider">
870++ <capability>
871++ <name>AssumeDefaultDomain</name>
872++ <description>Apply domain name prefix to account name at logon</description>
873++ <registry type="boolean"
874++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\AssumeDefaultDomain"
875++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\AssumeDefaultDomain" >
876++ <default>
877++ <value>false</value>
878++ </default>
879++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
880++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
881++ </registry>
882++ </capability>
883++ <capability>
884++ <name>CreateHomeDir</name>
885++ <description>Whether home directories should be automatically created upon user logon</description>
886++ <registry type="boolean"
887++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\CreateHomeDir"
888++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\CreateHomeDir" >
889++ <default>
890++ <value>true</value>
891++ </default>
892++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
893++ </registry>
894++ </capability>
895++ <capability>
896++ <name>CreateK5Login</name>
897++ <description>Whether .k5login file is to be created upon user logon</description>
898++ <registry type="boolean"
899++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\CreateK5Login"
900++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\CreateK5Login" >
901++ <default>
902++ <value>true</value>
903++ </default>
904++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
905++ </registry>
906++ </capability>
907++ <capability>
908++ <name>SyncSystemTime</name>
909++ <description>Whether system time should be syncronized with AD domain controller</description>
910++ <registry type="boolean"
911++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\SyncSystemTime"
912++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\SyncSystemTime" >
913++ <default>
914++ <value>true</value>
915++ </default>
916++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
917++ </registry>
918++ </capability>
919++ <capability>
920++ <name>TrimUserMembership</name>
921++ <description>Whether to remove a cached group membership entry derived from PAC with information from LDAP showing the user disappearing from a group.</description>
922++ <registry type="boolean"
923++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\TrimUserMembership"
924++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\TrimUserMembership" >
925++ <default>
926++ <value>true</value>
927++ </default>
928++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
929++ </registry>
930++ </capability>
931++ <capability>
932++ <name>LdapSignAndSeal</name>
933++ <description>Whether all LDAP traffic should be sent both signed and sealed</description>
934++ <registry type="boolean"
935++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\LdapSignAndSeal"
936++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\LdapSignAndSeal" >
937++ <default>
938++ <value>false</value>
939++ </default>
940++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
941++ </registry>
942++ </capability>
943++ <capability>
944++ <name>LogADNetworkConnectionEvents</name>
945++ <description>Configure lsass to log events for offline query failures and transitions</description>
946++ <registry type="boolean"
947++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\LogNetworkConnectionEvents"
948++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\LogNetworkConnectionEvents" >
949++ <default>
950++ <value>true</value>
951++ </default>
952++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
953++ </registry>
954++ </capability>
955++ <capability>
956++ <name>NssEnumerationEnabled</name>
957++ <description>Whether to enumerate users or groups for NSS</description>
958++ <registry type="boolean"
959++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\NssEnumerationEnabled"
960++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\NssEnumerationEnabled" >
961++ <default>
962++ <value>@enable_nss_enum_default@</value>
963++ </default>
964++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
965++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
966++ </registry>
967++ </capability>
968++ <capability>
969++ <name>NssGroupMembersQueryCacheOnly</name>
970++ <description>Whether to return only cached info for NSS group members</description>
971++ <registry type="boolean"
972++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\NssGroupMembersQueryCacheOnly"
973++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\NssGroupMembersQueryCacheOnly" >
974++ <default>
975++ <value>true</value>
976++ </default>
977++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
978++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
979++ </registry>
980++ </capability>
981++ <capability>
982++ <name>NssUserMembershipQueryCacheOnly</name>
983++ <description>Whether to return only cached info for NSS user's groups</description>
984++ <registry type="boolean"
985++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\NssUserMembershipQueryCacheOnly"
986++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\NssUserMembershipQueryCacheOnly" >
987++ <default>
988++ <value>false</value>
989++ </default>
990++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
991++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
992++ </registry>
993++ </capability>
994++ <capability>
995++ <name>RefreshUserCredentials</name>
996++ <description>Whether to refresh user credentials agaist AD domain controller</description>
997++ <registry type="boolean"
998++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\RefreshUserCredentials"
999++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\RefreshUserCredentials" >
1000++ <default>
1001++ <value>true</value>
1002++ </default>
1003++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1004++ </registry>
1005++ </capability>
1006++ <capability>
1007++ <name>CacheEntryExpiry</name>
1008++ <description>Duration for when lsass object cache entries are marked stale</description>
1009++ <registry type="dword"
1010++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\CacheEntryExpiry"
1011++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\CacheEntryExpiry" >
1012++ <description>Duration in seconds (s), minutes (m), hours (h) or days (d)</description>
1013++ <default>
1014++ <value>4h</value>
1015++ </default>
1016++ <accept>
1017++ <range min="0" max="86400" />
1018++ </accept>
1019++ <unit suffix="s" multiplier="1" />
1020++ <unit suffix="m" multiplier="60" />
1021++ <unit suffix="h" multiplier="3600" />
1022++ <unit suffix="d" multiplier="86400" />
1023++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1024++ </registry>
1025++ </capability>
1026++ <capability>
1027++ <name>TrustEnumerationWait</name>
1028++ <description>If true, wait for trust enumeration to complete before completing initialization.</description>
1029++ <registry type="boolean"
1030++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\TrustEnumerationWait"
1031++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\TrustEnumerationWait" >
1032++ <default>
1033++ <value>false</value>
1034++ </default>
1035++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1036++ </registry>
1037++ </capability>
1038++ <capability>
1039++ <name>TrustEnumerationWaitSeconds</name>
1040++ <description>If TrustEnumerationWait is true, the amount of time to wait for trust enumeration to complete before continuing. Use 0 to wait forever. </description>
1041++ <registry type="dword"
1042++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\TrustEnumerationWaitSeconds"
1043++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\TrustEnumerationWaitSeconds" >
1044++ <description>Duration in seconds (s), minutes (m), hours (h) or days (d)</description>
1045++ <default>
1046++ <value>0s</value>
1047++ </default>
1048++ <accept>
1049++ <range min="0" max="86400" />
1050++ </accept>
1051++ <unit suffix="s" multiplier="1" />
1052++ <unit suffix="m" multiplier="60" />
1053++ <unit suffix="h" multiplier="3600" />
1054++ <unit suffix="d" multiplier="86400" />
1055++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1056++ </registry>
1057++ </capability>
1058++ <capability>
1059++ <name>DomainManagerCheckDomainOnlineInterval</name>
1060++ <description>How often the domain manager should check whether a domain is back online</description>
1061++ <registry type="dword"
1062++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerCheckDomainOnlineInterval"
1063++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerCheckDomainOnlineInterval" >
1064++ <description>Duration in seconds (s), minutes (m), hours (h) or days (d)</description>
1065++ <default>
1066++ <value>5m</value>
1067++ </default>
1068++ <accept>
1069++ <range min="60" max="86400" />
1070++ </accept>
1071++ <unit suffix="s" multiplier="1" />
1072++ <unit suffix="m" multiplier="60" />
1073++ <unit suffix="h" multiplier="3600" />
1074++ <unit suffix="d" multiplier="86400" />
1075++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1076++ </registry>
1077++ </capability>
1078++ <capability>
1079++ <name>DomainManagerUnknownDomainCacheTimeout</name>
1080++ <description>How long an unknown domain is cached as unknown in the domain manager</description>
1081++ <registry type="dword"
1082++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerUnknownDomainCacheTimeout"
1083++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerUnknownDomainCacheTimeout" >
1084++ <description>Duration in seconds (s), minutes (m), hours (h) or days (d)</description>
1085++ <default>
1086++ <value>1h</value>
1087++ </default>
1088++ <accept>
1089++ <range min="60" max="86400" />
1090++ </accept>
1091++ <unit suffix="s" multiplier="1" />
1092++ <unit suffix="m" multiplier="60" />
1093++ <unit suffix="h" multiplier="3600" />
1094++ <unit suffix="d" multiplier="86400" />
1095++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1096++ </registry>
1097++ </capability>
1098++ <capability>
1099++ <name>MachinePasswordLifespan</name>
1100++ <description>Machine password expiration lifespan in seconds.</description>
1101++ <registry type="dword"
1102++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\MachinePasswordLifespan"
1103++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\MachinePasswordLifespan" >
1104++ <description>Duration in seconds (s), minutes (m), hours (h) or days (d). Example: 1d</description>
1105++ <default>
1106++ <value>30d</value>
1107++ </default>
1108++ <accept>
1109++ <range min="3600" max="31536000" />
1110++ </accept>
1111++ <accept>
1112++ <range min="0" max="0" />
1113++ </accept>
1114++ <unit suffix="s" multiplier="1" />
1115++ <unit suffix="m" multiplier="60" />
1116++ <unit suffix="h" multiplier="3600" />
1117++ <unit suffix="d" multiplier="86400" />
1118++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1119++ </registry>
1120++ </capability>
1121++ <capability>
1122++ <name>MemoryCacheSizeCap</name>
1123++ <description>The maximum bytes to use for the in-memory cache. Old data will be purged if the total cache size exceeds this limit. A value of 0 indicates no limit.</description>
1124++ <registry type="dword"
1125++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\MemoryCacheSizeCap"
1126++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\MemoryCacheSizeCap" >
1127++ <description>Size in bytes</description>
1128++ <default>
1129++ <value>0</value>
1130++ </default>
1131++ <unit suffix="B" multiplier="1" />
1132++ <unit suffix="KB" multiplier="1024" />
1133++ <unit suffix="MB" multiplier="1048576" />
1134++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1135++ </registry>
1136++ </capability>
1137++ <capability>
1138++ <name>HomeDirPrefix</name>
1139++ <description>Prefix path for user's home directory. This value is used in place of the %H in the HomeDirTemplate setting. Value must be an absolute path.</description>
1140++ <registry type="string"
1141++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\HomeDirPrefix"
1142++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\HomeDirPrefix" >
1143++ <description>Absolute path to the home directory.</description>
1144++ <default>
1145++ <value>@default_homedir_prefix@</value>
1146++ </default>
1147++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1148++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
1149++ </registry>
1150++ </capability>
1151++ <capability>
1152++ <name>HomeDirTemplate</name>
1153++ <description>Format string for user's home directory path. This value can contain substitution string markers for HomeDirPrefix (%H), Domain (%D), and User (%U).</description>
1154++ <registry type="string"
1155++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\HomeDirTemplate"
1156++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\HomeDirTemplate" >
1157++ <description>Absolute path to the home directory.</description>
1158++ <default>
1159++ <value>%H/local/%D/%U</value>
1160++ </default>
1161++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1162++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
1163++ </registry>
1164++ </capability>
1165++ <capability>
1166++ <name>HomeDirUmask</name>
1167++ <description>Umask for home directories</description>
1168++ <registry type="string"
1169++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\HomeDirUmask"
1170++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\HomeDirUmask" >
1171++ <description>String of octal digits for home directory umask</description>
1172++ <default>
1173++ <value>022</value>
1174++ </default>
1175++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1176++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
1177++ </registry>
1178++ </capability>
1179++ <capability>
1180++ <name>LoginShellTemplate</name>
1181++ <description>Default login shell template</description>
1182++ <registry type="string"
1183++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\LoginShellTemplate"
1184++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\LoginShellTemplate" >
1185++ <description>Path to shell</description>
1186++ <default>
1187++ <value>/bin/sh</value>
1188++ </default>
1189++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1190++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
1191++ </registry>
1192++ </capability>
1193++ <capability>
1194++ <name>SkeletonDirs</name>
1195++ <description>Skeleton home directory template directories</description>
1196++ <registry type="string"
1197++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\SkeletonDirs"
1198++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\SkeletonDirs" >
1199++ <description>Comma separated list of skeleton directories.</description>
1200++ <default>
1201++ <value>@default_skeldirs@</value>
1202++ </default>
1203++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1204++ </registry>
1205++ </capability>
1206++ <capability>
1207++ <name>UserDomainPrefix</name>
1208++ <description>Domain short name prefix to be used when AssumeDefaultDomain setting is enabled</description>
1209++ <Allowed>Domain short name of Active Directory domain that the user accounts reside. Blank will use the domain name which the computer is joined to.</Allowed>
1210++ <registry type="string"
1211++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\UserDomainPrefix"
1212++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\UserDomainPrefix" >
1213++ <description>Short name of Active Directory domain where the user accounts reside. Blank means use the domain name to which the computer is joined.</description>
1214++ <default>
1215++ <value></value>
1216++ </default>
1217++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1218++ <apply command="/opt/likewise/bin/lw-ad-cache --delete-all" />
1219++ </registry>
1220++ </capability>
1221++ <capability>
1222++ <name>DomainManagerIgnoreAllTrusts</name>
1223++ <description>When true, ignore all trusts during domain enumeration.</description>
1224++ <registry type="boolean"
1225++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerIgnoreAllTrusts"
1226++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerIgnoreAllTrusts" >
1227++ <default>
1228++ <value>false</value>
1229++ </default>
1230++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1231++ </registry>
1232++ </capability>
1233++ <capability>
1234++ <name>DomainManagerIncludeTrustsList</name>
1235++ <description>When DomainManagerIgnoreAllTrusts is true, these trusts are included</description>
1236++ <registry type="multistring"
1237++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerIncludeTrustsList"
1238++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerIncludeTrustsList" >
1239++ <description>A list of trusts.</description>
1240++ <default>
1241++ <value></value>
1242++ </default>
1243++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1244++ </registry>
1245++ </capability>
1246++ <capability>
1247++ <name>DomainManagerExcludeTrustsList</name>
1248++ <description>When DomainManagerIgnoreAllTrusts is false, these trusts are excluded.</description>
1249++ <registry type="multistring"
1250++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerExcludeTrustsList"
1251++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\DomainManagerExcludeTrustsList" >
1252++ <description>A list of trusts.</description>
1253++ <default>
1254++ <value></value>
1255++ </default>
1256++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1257++ </registry>
1258++ </capability>
1259++ <capability>
1260++ <name>RequireMembershipOf</name>
1261++ <description>Restrict logon access to computer to specific users or group members, or SIDs</description>
1262++ <registry type="multistring"
1263++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory\RequireMembershipOf"
1264++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\ActiveDirectory\RequireMembershipOf" >
1265++ <description>User names, group names, or SIDs.</description>
1266++ <default>
1267++ <value></value>
1268++ </default>
1269++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1270++ </registry>
1271++ </capability>
1272++</section>
1273++<section section="Lsass - Local provider">
1274++ <capability>
1275++ <name>Local_AcceptNTLMv1</name>
1276++ <description></description>
1277++ <registry type="boolean"
1278++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\Local\AcceptNTLMv1"
1279++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\Local\AcceptNTLMv1" >
1280++ <default>
1281++ <value>true</value>
1282++ </default>
1283++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1284++ </registry>
1285++ </capability>
1286++ <capability>
1287++ <name>Local_HomeDirTemplate</name>
1288++ <description>Format string for lsass local provider account user's home directory path. This value can contain substitution string markers for HomeDirPrefix (%H), Domain (%D), and User (%U).</description>
1289++ <registry type="string"
1290++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\Local\HomeDirTemplate"
1291++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\Local\HomeDirTemplate" >
1292++ <description>Absolute path to the home directory.</description>
1293++ <default>
1294++ <value>%H/local/%D/%U</value>
1295++ </default>
1296++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1297++ </registry>
1298++ </capability>
1299++ <capability>
1300++ <name>Local_HomeDirUmask</name>
1301++ <description>Umask for lsass local provider account home directories</description>
1302++ <registry type="string"
1303++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\Local\HomeDirUmask"
1304++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\Local\HomeDirUmask" >
1305++ <description>Absolute path to the home directory.</description>
1306++ <default>
1307++ <value>022</value>
1308++ </default>
1309++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1310++ </registry>
1311++ </capability>
1312++ <capability>
1313++ <name>Local_LoginShellTemplate</name>
1314++ <description>Default login shell template for lsass local provider accounts</description>
1315++ <registry type="string"
1316++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\Local\LoginShellTemplate"
1317++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\Local\LoginShellTemplate" >
1318++ <description>Absolute path to the home directory.</description>
1319++ <default>
1320++ <value>/bin/sh</value>
1321++ </default>
1322++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1323++ </registry>
1324++ </capability>
1325++ <capability>
1326++ <name>Local_SkeletonDirs</name>
1327++ <description>Skeleton home directory template directories for lsass local provider accounts</description>
1328++ <registry type="string"
1329++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\Local\SkeletonDirs"
1330++ gp-path="HKEY_THIS_MACHINE\Policy\Services\lsass\Parameters\Providers\Local\SkeletonDirs" >
1331++ <description>Absolute path to the home directory.</description>
1332++ <default>
1333++ <value>@default_skeldirs@</value>
1334++ </default>
1335++ <apply command="/opt/likewise/bin/lwsm refresh lsass" />
1336++ </registry>
1337++ </capability>
1338++ </section>
1339++ <section section="System Initialization">
1340++ <capability>
1341++ <name>LsassAutostart</name>
1342++ <description>Start lsassd when lwsmd starts.</description>
1343++ <registry type="boolean"
1344++ lp-path="HKEY_THIS_MACHINE\Services\lsass\Autostart" >
1345++ <default>
1346++ <value>true</value>
1347++ </default>
1348++ </registry>
1349++ </capability>
1350++ <capability>
1351++ <name>EventlogAutostart</name>
1352++ <description>Start eventlogd when lwsmd starts.</description>
1353++ <registry type="boolean"
1354++ lp-path="HKEY_THIS_MACHINE\Services\eventlog\Autostart" >
1355++ <default>
1356++ <value>true</value>
1357++ </default>
1358++ </registry>
1359++ </capability>
1360++ <capability>
1361++ <name>GpagentAutostart</name>
1362++ <description>Start gpagentd when lwsmd starts.</description>
1363++ <registry type="boolean"
1364++ lp-path="HKEY_THIS_MACHINE\Services\gpagent\Autostart" >
1365++ <default>
1366++ <value>true</value>
1367++ </default>
1368++ </registry>
1369++ </capability>
1370++ </section>
1371++</capabilities>
1372++
1373++<!--
1374++#Additional Likewise settings to be converted to Capabilities
1375++
1376++[HKEY_THIS_MACHINE\Services\lsass\Parameters\NTLM]
1377++"SendNTLMv2"=dword:00000000
1378++"Support128bit"=dword:00000001
1379++"Support56bit"=dword:00000001
1380++"SupportKeyExchange"=dword:00000001
1381++"SupportNTLM2SessionSecurity"=dword:00000001
1382++"SupportUnicode"=dword:00000001
1383++
1384++-->
1385+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/etc/Makefile.am likewise-open-6.0.0.53010/lwconfig/etc/Makefile.am
1386+--- likewise-open-6.0.0.53010.old/lwconfig/etc/Makefile.am 1969-12-31 16:00:00.000000000 -0800
1387++++ likewise-open-6.0.0.53010/lwconfig/etc/Makefile.am 2011-01-17 11:51:56.000000000 -0800
1388+@@ -0,0 +1 @@
1389++lwconfig_DATA = lwconfig.xml
1390+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/include/keep-me likewise-open-6.0.0.53010/lwconfig/include/keep-me
1391+--- likewise-open-6.0.0.53010.old/lwconfig/include/keep-me 1969-12-31 16:00:00.000000000 -0800
1392++++ likewise-open-6.0.0.53010/lwconfig/include/keep-me 2011-02-23 17:47:17.000000000 -0800
1393+@@ -0,0 +1 @@
1394++keep-this-file
1395+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/Makefile.am likewise-open-6.0.0.53010/lwconfig/Makefile.am
1396+--- likewise-open-6.0.0.53010.old/lwconfig/Makefile.am 1969-12-31 16:00:00.000000000 -0800
1397++++ likewise-open-6.0.0.53010/lwconfig/Makefile.am 2011-01-17 11:51:56.000000000 -0800
1398+@@ -0,0 +1,3 @@
1399++SUBDIRS = \
1400++ etc \
1401++ src
1402+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/capability.c likewise-open-6.0.0.53010/lwconfig/src/capability.c
1403+--- likewise-open-6.0.0.53010.old/lwconfig/src/capability.c 1969-12-31 16:00:00.000000000 -0800
1404++++ likewise-open-6.0.0.53010/lwconfig/src/capability.c 2011-02-23 16:23:58.000000000 -0800
1405+@@ -0,0 +1,1788 @@
1406++/*
1407++ * Copyright (c) Likewise Software. All rights reserved.
1408++ *
1409++ * This program is free software; you can redistribute it and/or modify
1410++ * it under the terms of the GNU General Public License as published by
1411++ * the Free Software Foundation; either version 2 of the License, or (at
1412++ * your option) any later version.
1413++ *
1414++ * This program is distributed in the hope that it will be useful, but
1415++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1416++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1417++ * for more details. You should have received a copy of the GNU General
1418++ * Public License along with this program. If not, see
1419++ * <http://www.gnu.org/licenses/>.
1420++ *
1421++ * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
1422++ * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
1423++ * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
1424++ * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
1425++ * GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
1426++ * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
1427++ * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
1428++ * license@likewise.com
1429++ */
1430++
1431++#include "includes.h"
1432++
1433++static
1434++xmlNodePtr
1435++FindNext(
1436++ xmlNodePtr pxChild,
1437++ PSTR pszChild
1438++ );
1439++
1440++static
1441++DWORD
1442++DefaultValue(
1443++ xmlDocPtr xmlDoc,
1444++ xmlNodePtr pxDefault,
1445++ PSTR *ppszValue
1446++ );
1447++
1448++static
1449++DWORD
1450++GetLocalPolicyValue(
1451++ PCAPABILITY pCapability,
1452++ PSTR *ppszaValue
1453++ );
1454++
1455++static
1456++DWORD
1457++RegistryAllocate(
1458++ xmlDocPtr xmlDoc,
1459++ xmlNodePtr pxRegistry,
1460++ PREGISTRY *ppRegistry)
1461++{
1462++ DWORD dwError = 0;
1463++ PREGISTRY pRegistry = NULL;
1464++ xmlChar *xszLocalPath = NULL;
1465++ PSTR pszLocalPath = NULL;
1466++ xmlChar *xszPolicyPath = NULL;
1467++ PSTR pszPolicyPath = NULL;
1468++ xmlChar *xszType = NULL;
1469++ PSTR pszType = NULL;
1470++ xmlChar *xszDescription = NULL;
1471++ PSTR pszDescription = NULL;
1472++ PSTR pszaDefault = NULL;
1473++ xmlNodePtr child = NULL;
1474++
1475++ xszLocalPath = xmlGetProp(pxRegistry, (const xmlChar*)"lp-path");
1476++ xszPolicyPath = xmlGetProp(pxRegistry, (const xmlChar*)"gp-path");
1477++ xszType = xmlGetProp(pxRegistry, (const xmlChar*)"type");
1478++
1479++ if (!xszLocalPath && !xszPolicyPath)
1480++ {
1481++ dwError = APP_ERROR_XML_MISSING_ATTRIBUTE;
1482++ BAIL_ON_ERROR(dwError);
1483++ }
1484++
1485++ if (!xszType)
1486++ {
1487++ dwError = APP_ERROR_XML_MISSING_ATTRIBUTE;
1488++ BAIL_ON_ERROR(dwError);
1489++ }
1490++
1491++ if (xszLocalPath)
1492++ {
1493++ dwError = LwAllocateString((PCSTR)xszLocalPath, &pszLocalPath);
1494++ BAIL_ON_ERROR(dwError);
1495++ }
1496++
1497++ if (xszPolicyPath)
1498++ {
1499++ dwError = LwAllocateString((PCSTR)xszPolicyPath, &pszPolicyPath);
1500++ BAIL_ON_ERROR(dwError);
1501++ }
1502++
1503++ dwError = LwAllocateString((PCSTR)xszType, &pszType);
1504++ BAIL_ON_ERROR(dwError);
1505++
1506++ for (child = pxRegistry->xmlChildrenNode; child; child = child->next)
1507++ {
1508++ if (child->type != XML_ELEMENT_NODE)
1509++ continue;
1510++ if (!xmlStrcmp(child->name, (const xmlChar*)"default"))
1511++ {
1512++ dwError = DefaultValue(xmlDoc, child, &pszaDefault);
1513++ BAIL_ON_ERROR(dwError);
1514++ }
1515++ else if (!xmlStrcmp(child->name, (const xmlChar*)"description"))
1516++ {
1517++ xszDescription = xmlNodeListGetString(xmlDoc,
1518++ child->xmlChildrenNode, TRUE);
1519++ if (xszDescription)
1520++ {
1521++ dwError = LwAllocateString((PCSTR)xszDescription, &pszDescription);
1522++ BAIL_ON_ERROR(dwError);
1523++ }
1524++ }
1525++ }
1526++
1527++ dwError = LwAllocateMemory(sizeof(*pRegistry), (PVOID*)&pRegistry);
1528++ BAIL_ON_ERROR(dwError);
1529++
1530++ pRegistry->pxRegistry = pxRegistry;
1531++ pRegistry->pszLocalPath = pszLocalPath;
1532++ pRegistry->pszPolicyPath = pszPolicyPath;
1533++ pRegistry->pszType = pszType;
1534++ pRegistry->pszDescription = pszDescription;
1535++ pRegistry->pszaDefault = pszaDefault;
1536++
1537++ *ppRegistry = pRegistry;
1538++
1539++cleanup:
1540++
1541++ xmlFree(xszLocalPath);
1542++ xmlFree(xszPolicyPath);
1543++ xmlFree(xszType);
1544++ xmlFree(xszDescription);
1545++ return dwError;
1546++
1547++error:
1548++ LW_SAFE_FREE_STRING(pszLocalPath);
1549++ LW_SAFE_FREE_STRING(pszPolicyPath);
1550++ LW_SAFE_FREE_STRING(pszType);
1551++ LW_SAFE_FREE_STRING(pszDescription);
1552++ LW_SAFE_FREE_MEMORY(pszaDefault);
1553++ LW_SAFE_FREE_MEMORY(pRegistry);
1554++ goto cleanup;
1555++}
1556++
1557++static
1558++void
1559++RegistryFree(
1560++ PREGISTRY pRegistry
1561++ )
1562++{
1563++ if (pRegistry)
1564++ {
1565++ LW_SAFE_FREE_STRING(pRegistry->pszLocalPath);
1566++ LW_SAFE_FREE_STRING(pRegistry->pszPolicyPath);
1567++ LW_SAFE_FREE_STRING(pRegistry->pszType);
1568++ LW_SAFE_FREE_STRING(pRegistry->pszDescription);
1569++ LW_SAFE_FREE_MEMORY(pRegistry->pszaDefault);
1570++
1571++ LW_SAFE_FREE_MEMORY(pRegistry);
1572++ }
1573++}
1574++
1575++
1576++DWORD
1577++CapabilityAllocate(
1578++ xmlDocPtr xmlDoc,
1579++ xmlNodePtr xmlNodeCapability,
1580++ PCAPABILITY *ppCapability
1581++ )
1582++{
1583++ DWORD dwError = 0;
1584++ xmlChar *xszName = NULL;
1585++ PSTR pszName = NULL;
1586++ xmlChar *xszDescription = NULL;
1587++ PSTR pszDescription = NULL;
1588++ xmlNodePtr child = NULL;
1589++ PREGISTRY pRegistry = NULL;
1590++ PCAPABILITY pCapability = NULL;
1591++
1592++ if (!xmlNodeCapability)
1593++ {
1594++ dwError = ERROR_INVALID_PARAMETER;
1595++ BAIL_ON_ERROR(dwError);
1596++ }
1597++
1598++ for (child = xmlNodeCapability->xmlChildrenNode; child; child = child->next)
1599++ {
1600++ if (child->type != XML_ELEMENT_NODE)
1601++ continue;
1602++
1603++ if (!xmlStrcmp(child->name, (const xmlChar*)"name"))
1604++ {
1605++ if (xszName)
1606++ {
1607++ dwError = APP_ERROR_XML_DUPLICATED_ELEMENT;
1608++ BAIL_ON_ERROR(dwError);
1609++ }
1610++ xszName = xmlNodeListGetString(
1611++ xmlDoc,
1612++ child->xmlChildrenNode,
1613++ TRUE);
1614++ }
1615++ else if (!xmlStrcmp(child->name, (const xmlChar*)"description"))
1616++ {
1617++ if (xszDescription)
1618++ {
1619++ dwError = APP_ERROR_XML_DUPLICATED_ELEMENT;
1620++ BAIL_ON_ERROR(dwError);
1621++ }
1622++ xszDescription = xmlNodeListGetString(
1623++ xmlDoc,
1624++ child->xmlChildrenNode,
1625++ TRUE);
1626++ }
1627++ else if (!xmlStrcmp(child->name, (const xmlChar*)"registry"))
1628++ {
1629++ if (pRegistry)
1630++ {
1631++ dwError = APP_ERROR_XML_DUPLICATED_ELEMENT;
1632++ BAIL_ON_ERROR(dwError);
1633++ }
1634++ dwError = RegistryAllocate(xmlDoc, child, &pRegistry);
1635++ BAIL_ON_ERROR(dwError);
1636++ }
1637++ }
1638++
1639++ if (!xszName || xszName[0] == '\0')
1640++ {
1641++ fprintf(stderr, "Improper format: Element 'name' not found or empty.\n");
1642++ dwError = APP_ERROR_XML_MISSING_ELEMENT;
1643++ BAIL_ON_ERROR(dwError);
1644++ }
1645++
1646++ dwError = LwAllocateString((char*)xszName, &pszName);
1647++ BAIL_ON_ERROR(dwError);
1648++
1649++ if (xszDescription)
1650++ {
1651++ dwError = LwAllocateString((char*)xszDescription, &pszDescription);
1652++ BAIL_ON_ERROR(dwError);
1653++ }
1654++
1655++ dwError = LwAllocateMemory(sizeof(*pCapability), (PVOID*)&pCapability);
1656++ BAIL_ON_ERROR(dwError);
1657++
1658++ pCapability->xmlDoc = xmlDoc;
1659++
1660++ pCapability->xmlNodeCapability = xmlNodeCapability;
1661++
1662++ pCapability->pszName = pszName;
1663++ pszName = NULL;
1664++
1665++ pCapability->pszDescription = pszDescription;
1666++ pszDescription = NULL;
1667++
1668++ pCapability->pRegistry = pRegistry;
1669++ pRegistry = NULL;
1670++
1671++ *ppCapability = pCapability;
1672++
1673++cleanup:
1674++ xmlFree(xszName);
1675++ xmlFree(xszDescription);
1676++ return dwError;
1677++
1678++error:
1679++
1680++ LW_SAFE_FREE_STRING(pszName);
1681++ LW_SAFE_FREE_STRING(pszDescription);
1682++ RegistryFree(pRegistry);
1683++ CapabilityFree(pCapability);
1684++ goto cleanup;
1685++}
1686++
1687++void
1688++CapabilityFree(
1689++ PCAPABILITY pCapability
1690++ )
1691++{
1692++ if (pCapability)
1693++ {
1694++ RegistryFree(pCapability->pRegistry);
1695++ LW_SAFE_FREE_MEMORY(pCapability->pszName);
1696++ LW_SAFE_FREE_MEMORY(pCapability->pszDescription);
1697++ LW_SAFE_FREE_MEMORY(pCapability);
1698++ }
1699++}
1700++
1701++/*
1702++ If pszName matches exactly one item, use that.
1703++ Else if pszName matches more than one item exactly, report an error.
1704++ Else if pszName is prefix matches exactly one item, use that.
1705++ Else if pszName prefix matches more than one item, print the matches and
1706++ report an error.
1707++*/
1708++DWORD
1709++CapabilityFindByName(
1710++ xmlDocPtr xmlDoc,
1711++ PCSTR pszName,
1712++ PCAPABILITY *ppCapability
1713++ )
1714++{
1715++ DWORD dwError = 0;
1716++
1717++ xmlXPathContextPtr xpathCtx = NULL;
1718++ xmlXPathObjectPtr xpathObj = NULL;
1719++ xmlNodeSetPtr nodes = NULL; // Convienence pointer
1720++ xmlNodePtr xmlNodeCapability = NULL;
1721++ PCAPABILITY pCapability = NULL;
1722++ DWORD dwNameLength = 0;
1723++ BOOLEAN bNameMatchesMany = FALSE;
1724++ BOOLEAN bNameMatchesExactly = FALSE;
1725++ size_t i;
1726++ xmlNodePtr child = NULL;
1727++ xmlChar *xszName = NULL;
1728++
1729++ dwNameLength = strlen(pszName); // Calculate once
1730++
1731++ xpathCtx = xmlXPathNewContext(xmlDoc);
1732++ if (!xpathCtx)
1733++ {
1734++ dwError = ERROR_OUTOFMEMORY;
1735++ BAIL_ON_ERROR(dwError);
1736++ }
1737++
1738++ xpathObj = xmlXPathEvalExpression(
1739++ (const xmlChar*)"/capabilities/section/capability",
1740++ xpathCtx);
1741++ if (!xpathObj)
1742++ {
1743++ dwError = APP_ERROR_XPATH_EVAL_FAILED;
1744++ BAIL_ON_ERROR(dwError);
1745++ }
1746++
1747++ nodes = xpathObj->nodesetval;
1748++ for (i = 0; i < nodes->nodeNr; i++)
1749++ {
1750++ if (nodes->nodeTab[i]->type != XML_ELEMENT_NODE)
1751++ continue;
1752++
1753++ if (xmlStrcmp((const xmlChar*)"capability", nodes->nodeTab[i]->name))
1754++ continue;
1755++
1756++ child = FindNext(nodes->nodeTab[i]->xmlChildrenNode, "name");
1757++ if (!child)
1758++ continue;
1759++
1760++ xszName = xmlNodeListGetString(xmlDoc, child->xmlChildrenNode, TRUE);
1761++ if (!xszName)
1762++ {
1763++ dwError = ERROR_OUTOFMEMORY;
1764++ BAIL_ON_ERROR(dwError);
1765++ }
1766++
1767++ if (!xmlStrcasecmp(xszName, (const xmlChar*)pszName))
1768++ {
1769++ if (bNameMatchesExactly)
1770++ {
1771++ dwError = APP_ERROR_XML_DUPLICATED_ELEMENT;
1772++ BAIL_ON_ERROR(dwError);
1773++ }
1774++
1775++ xmlNodeCapability = nodes->nodeTab[i];
1776++ bNameMatchesExactly = TRUE;
1777++ }
1778++ else if (!xmlStrncasecmp(xszName, (const xmlChar*) pszName, dwNameLength))
1779++ {
1780++ if (!bNameMatchesExactly)
1781++ {
1782++ if (xmlNodeCapability)
1783++ {
1784++ bNameMatchesMany = TRUE;
1785++ }
1786++ else
1787++ {
1788++ xmlNodeCapability = nodes->nodeTab[i];
1789++ }
1790++ }
1791++ }
1792++
1793++ xmlFree(xszName);
1794++ xszName = NULL;
1795++ }
1796++
1797++ if (!bNameMatchesExactly && bNameMatchesMany)
1798++ {
1799++ fprintf(stderr, "%s partially matches:\n", pszName);
1800++ for (i = 0; i < nodes->nodeNr; i++)
1801++ {
1802++ if (nodes->nodeTab[i]->type != XML_ELEMENT_NODE)
1803++ continue;
1804++
1805++ if (xmlStrcmp((const xmlChar*)"capability", nodes->nodeTab[i]->name))
1806++ continue;
1807++
1808++ child = FindNext(nodes->nodeTab[i]->xmlChildrenNode, "name");
1809++ if (!child)
1810++ continue;
1811++
1812++
1813++ xszName = xmlNodeListGetString(xmlDoc, child->xmlChildrenNode, TRUE);
1814++ if (!xszName)
1815++ {
1816++ dwError = ERROR_OUTOFMEMORY;
1817++ BAIL_ON_ERROR(dwError);
1818++ }
1819++
1820++ if (!xmlStrncasecmp(xszName, (const xmlChar*)pszName, dwNameLength))
1821++ {
1822++ fprintf(stderr, "%s\n", (PCSTR)xszName);
1823++ }
1824++
1825++ xmlFree(xszName);
1826++ xszName = NULL;
1827++ }
1828++ dwError = APP_ERROR_CAPABILITY_MULTIPLE_MATCHES;
1829++ BAIL_ON_ERROR(dwError);
1830++ }
1831++ else if (!xmlNodeCapability)
1832++ {
1833++ dwError = APP_ERROR_CAPABILITY_NOT_FOUND;
1834++ BAIL_ON_ERROR(dwError);
1835++ }
1836++
1837++ dwError = CapabilityAllocate(xmlDoc, xmlNodeCapability, &pCapability);
1838++ BAIL_ON_ERROR(dwError);
1839++
1840++ *ppCapability = pCapability;
1841++
1842++cleanup:
1843++
1844++ xmlXPathFreeObject(xpathObj);
1845++ xmlXPathFreeContext(xpathCtx);
1846++
1847++ xmlFree(xszName);
1848++ xszName = NULL;
1849++
1850++ return dwError;
1851++
1852++error:
1853++
1854++ CapabilityFree(pCapability);
1855++ goto cleanup;
1856++}
1857++
1858++static
1859++DWORD
1860++ValidateString(
1861++ PCSTR pszValue,
1862++ xmlDocPtr xmlDoc,
1863++ xmlNodePtr pxRegistry,
1864++ PBOOLEAN pbAccept
1865++ )
1866++{
1867++ DWORD dwError = 0;
1868++ xmlNodePtr xmlAccept = NULL;
1869++ xmlNodePtr xmlAcceptChild = NULL;
1870++ const DWORD UNDECIDED = 0;
1871++ const DWORD ACCEPT_VALUE = 1;
1872++ const DWORD REJECT_VALUE = 2;
1873++ DWORD dwDecision = UNDECIDED;
1874++ const DWORD NOTHING = 0;
1875++ const DWORD ACCEPT = 1;
1876++ const DWORD REJECT = 2;
1877++ DWORD dwState = NOTHING;
1878++ xmlChar *xszValue = NULL;
1879++ xmlChar *xszPattern = NULL;
1880++ regex_t patternExp;
1881++ regmatch_t matches[5];
1882++
1883++
1884++ for (xmlAccept = pxRegistry->xmlChildrenNode;
1885++ xmlAccept && dwDecision == UNDECIDED;
1886++ xmlAccept = xmlAccept->next)
1887++ {
1888++ if (xmlAccept->type != XML_ELEMENT_NODE)
1889++ continue;
1890++
1891++ if (!xmlStrcmp(xmlAccept->name, (const xmlChar*)"accept"))
1892++ {
1893++ dwState = ACCEPT;
1894++ }
1895++ else if (!xmlStrcmp(xmlAccept->name, (const xmlChar*)"reject"))
1896++ {
1897++ dwState = REJECT;
1898++ }
1899++ else
1900++ {
1901++ continue;
1902++ }
1903++
1904++ for (xmlAcceptChild = xmlAccept->xmlChildrenNode;
1905++ xmlAcceptChild && dwDecision == UNDECIDED;
1906++ xmlAcceptChild = xmlAcceptChild->next)
1907++ {
1908++ if (xmlAcceptChild->type != XML_ELEMENT_NODE)
1909++ continue;
1910++
1911++ if (!xmlStrcmp(xmlAcceptChild->name, (const xmlChar*)"value"))
1912++ {
1913++ xszValue = xmlNodeListGetString(
1914++ xmlDoc,
1915++ xmlAcceptChild->xmlChildrenNode,
1916++ TRUE);
1917++ if (xszValue && !strcmp((PCSTR)xszValue, pszValue))
1918++ {
1919++ if (dwState == ACCEPT)
1920++ {
1921++ dwDecision = ACCEPT_VALUE;
1922++ }
1923++ else
1924++ {
1925++ dwDecision = REJECT_VALUE;
1926++ }
1927++ }
1928++ if (xszValue)
1929++ {
1930++ xmlFree(xszValue);
1931++ xszValue = NULL;
1932++ }
1933++
1934++ } else if (!xmlStrcmp(
1935++ xmlAcceptChild->name,
1936++ (const xmlChar*)"pattern"))
1937++ {
1938++ xszPattern = xmlNodeListGetString(
1939++ xmlDoc,
1940++ xmlAcceptChild->xmlChildrenNode,
1941++ TRUE);
1942++
1943++ if (xszPattern)
1944++ {
1945++ if (!regcomp(&patternExp, (PCSTR)xszPattern, REG_EXTENDED))
1946++ {
1947++ if (!regexec(&patternExp, pszValue,
1948++ sizeof(matches)/sizeof(matches[0]),
1949++ matches,
1950++ 0))
1951++ {
1952++ if (dwState == ACCEPT)
1953++ {
1954++ dwDecision = ACCEPT_VALUE;
1955++ }
1956++ else
1957++ {
1958++ dwDecision = REJECT_VALUE;
1959++ }
1960++ }
1961++ regfree(&patternExp);
1962++ }
1963++ }
1964++ if (xszPattern)
1965++ {
1966++ xmlFree(xszPattern);
1967++ xszPattern = NULL;
1968++ }
1969++ }
1970++ }
1971++ }
1972++
1973++ if (dwDecision == ACCEPT_VALUE)
1974++ {
1975++ *pbAccept = TRUE;
1976++ }
1977++ else if (dwDecision == REJECT_VALUE)
1978++ {
1979++ *pbAccept = FALSE;
1980++ }
1981++ else
1982++ {
1983++ if (dwState == NOTHING)
1984++ {
1985++ *pbAccept = TRUE;
1986++ }
1987++ else if (dwState == ACCEPT)
1988++ {
1989++ *pbAccept = FALSE;
1990++ }
1991++ else if (dwState == REJECT)
1992++ {
1993++ *pbAccept = TRUE;
1994++ }
1995++ }
1996++
1997++ if (xszValue)
1998++ {
1999++ xmlFree(xszValue);
2000++ xszValue = NULL;
2001++ }
2002++ if (xszPattern)
2003++ {
2004++ xmlFree(xszPattern);
2005++ xszPattern = NULL;
2006++ }
2007++
2008++ return dwError;
2009++}
2010++
2011++static
2012++DWORD
2013++CapabilityRegistryGetUnitMultiplier(
2014++ PCSTR pszUnit,
2015++ xmlNodePtr pxRegistry,
2016++ PBOOLEAN pbMatched,
2017++ PDWORD pdwMultiplier,
2018++ PDWORD pdwDivisor
2019++ )
2020++{
2021++ DWORD dwError = 0;
2022++ xmlChar* xszUnitSuffix = NULL;
2023++ xmlChar* xszUnitMultiplier = NULL;
2024++ xmlChar* xszUnitDivisor = NULL;
2025++ DWORD dwUnitMultiplier = 1;
2026++ DWORD dwUnitDivisor = 1;
2027++ xmlNodePtr child = NULL;
2028++
2029++ if (pxRegistry)
2030++ child = pxRegistry->xmlChildrenNode;
2031++ for (; child; child = child->next)
2032++ {
2033++ if (child->type != XML_ELEMENT_NODE)
2034++ continue;
2035++
2036++ if (!xmlStrcmp(child->name, (const xmlChar*)"unit"))
2037++ {
2038++ xszUnitSuffix = xmlGetProp(child, (const xmlChar*)"suffix");
2039++ if (xszUnitSuffix && !strcmp((PCSTR)xszUnitSuffix, pszUnit))
2040++ break;
2041++ }
2042++ }
2043++
2044++ if (child)
2045++ xszUnitMultiplier = xmlGetProp(child, (const xmlChar*)"multiplier");
2046++ if (xszUnitMultiplier)
2047++ {
2048++ dwUnitMultiplier = strtol((PCSTR)xszUnitMultiplier, NULL, 10);
2049++ }
2050++
2051++ if (child)
2052++ xszUnitDivisor = xmlGetProp(child, (xmlChar*)"divisor");
2053++ if (xszUnitDivisor)
2054++ {
2055++ dwUnitDivisor = strtol((PCSTR)xszUnitDivisor, NULL, 10);
2056++ }
2057++
2058++ *pdwMultiplier = dwUnitMultiplier;
2059++ *pdwDivisor = dwUnitDivisor;
2060++ *pbMatched = TRUE;
2061++
2062++ xmlFree(xszUnitSuffix);
2063++ xszUnitSuffix = NULL;
2064++
2065++ xmlFree(xszUnitMultiplier);
2066++ xszUnitMultiplier = NULL;
2067++
2068++ xmlFree(xszUnitDivisor);
2069++ xszUnitDivisor = NULL;
2070++
2071++ return dwError;
2072++}
2073++
2074++static
2075++DWORD
2076++CapabilityNormalizeDword(
2077++ PCSTR pszValue,
2078++ xmlNodePtr pxRegistry,
2079++ PDWORD pdwValue
2080++ )
2081++{
2082++ DWORD dwError = 0;
2083++ PSTR pszEndChar = NULL; /* Don't free */
2084++ BOOLEAN bMatched = FALSE;
2085++ DWORD dwValue = 0;
2086++
2087++ dwValue = strtol(pszValue, &pszEndChar, 10);
2088++ if (dwValue == 0 && pszValue == pszEndChar)
2089++ {
2090++ fprintf(
2091++ stderr,
2092++ "Invalid parameter '%s': could not interpret as dword\n",
2093++ pszValue);
2094++ dwError = APP_ERROR_INVALID_DWORD;
2095++ BAIL_ON_ERROR(dwError);
2096++ }
2097++
2098++ // Left over characters indicate a suffix -- look for element 'unit'.
2099++ if (pszEndChar && *pszEndChar != '\0')
2100++ {
2101++ DWORD dwUnitMultiplier = 1;
2102++ DWORD dwUnitDivisor = 1;
2103++
2104++ dwError = CapabilityRegistryGetUnitMultiplier(
2105++ pszEndChar,
2106++ pxRegistry,
2107++ &bMatched,
2108++ &dwUnitMultiplier,
2109++ &dwUnitDivisor);
2110++ BAIL_ON_ERROR(dwError);
2111++
2112++ if (!bMatched)
2113++ {
2114++ fprintf(stderr, "Invalid parameter '%s': could not interpret %s\n",
2115++ pszValue, pszEndChar);
2116++ dwError = APP_ERROR_INVALID_SUFFIX;
2117++ BAIL_ON_ERROR(dwError);
2118++ }
2119++
2120++
2121++ dwValue = dwValue * dwUnitMultiplier;
2122++ dwValue = dwValue / dwUnitDivisor;
2123++ }
2124++
2125++ *pdwValue = dwValue;
2126++
2127++cleanup:
2128++
2129++ return dwError;
2130++
2131++error:
2132++
2133++ goto cleanup;
2134++}
2135++
2136++static
2137++DWORD
2138++ValidateDword(
2139++ DWORD dwValue,
2140++ xmlNodePtr pxRegistry,
2141++ PBOOLEAN pbAccept
2142++ )
2143++{
2144++ DWORD dwError = 0;
2145++ xmlNodePtr xmlAccept = NULL;
2146++ xmlNodePtr xmlRange = NULL;
2147++ xmlChar *xszMin = NULL;
2148++ xmlChar *xszMax = NULL;
2149++ DWORD dwMin = 0;
2150++ DWORD dwMax = 0;
2151++ const DWORD UNDECIDED = 0;
2152++ const DWORD ACCEPT_VALUE = 1;
2153++ const DWORD REJECT_VALUE = 2;
2154++ DWORD dwDecision = UNDECIDED;
2155++ const DWORD NOTHING = 0;
2156++ const DWORD ACCEPT = 1;
2157++ const DWORD REJECT = 2;
2158++ DWORD dwState = NOTHING;
2159++
2160++ for (xmlAccept = pxRegistry->xmlChildrenNode;
2161++ xmlAccept && dwDecision == UNDECIDED;
2162++ xmlAccept = xmlAccept->next)
2163++ {
2164++ if (xmlAccept->type != XML_ELEMENT_NODE)
2165++ continue;
2166++
2167++ if (!xmlStrcmp(xmlAccept->name, (const xmlChar*)"accept"))
2168++ {
2169++ dwState = ACCEPT;
2170++ }
2171++ else if (!xmlStrcmp(xmlAccept->name, (const xmlChar*)"reject"))
2172++ {
2173++ dwState = REJECT;
2174++ }
2175++ else
2176++ {
2177++ continue;
2178++ }
2179++
2180++ for (xmlRange = xmlAccept->xmlChildrenNode;
2181++ xmlRange && dwDecision == UNDECIDED;
2182++ xmlRange = xmlRange->next)
2183++ {
2184++ if (xmlRange->type != XML_ELEMENT_NODE)
2185++ continue;
2186++
2187++ if (!xmlStrcmp(xmlRange->name, (const xmlChar*)"range"))
2188++ {
2189++ xszMin = xmlGetProp(xmlRange, (const xmlChar*)"min");
2190++ xszMax = xmlGetProp(xmlRange, (const xmlChar*)"max");
2191++
2192++ dwError = CapabilityNormalizeDword(
2193++ (PCSTR)xszMin,
2194++ pxRegistry,
2195++ &dwMin);
2196++ BAIL_ON_ERROR(dwError);
2197++
2198++ dwError = CapabilityNormalizeDword(
2199++ (PCSTR)xszMax,
2200++ pxRegistry,
2201++ &dwMax);
2202++ BAIL_ON_ERROR(dwError);
2203++
2204++ if (dwMin <= dwValue && dwValue <= dwMax)
2205++ {
2206++ if (dwState == ACCEPT)
2207++ {
2208++ dwDecision = ACCEPT_VALUE;
2209++ }
2210++ else
2211++ dwDecision = REJECT_VALUE;
2212++ }
2213++
2214++ if (xszMin)
2215++ {
2216++ xmlFree(xszMin);
2217++ xszMin = NULL;
2218++ }
2219++ if (xszMax)
2220++ {
2221++ xmlFree(xszMax);
2222++ xszMax = NULL;
2223++ }
2224++ }
2225++ }
2226++ }
2227++
2228++ if (dwDecision == ACCEPT_VALUE)
2229++ {
2230++ *pbAccept = TRUE;
2231++ }
2232++ else if (dwDecision == REJECT_VALUE)
2233++ {
2234++ *pbAccept = FALSE;
2235++ }
2236++ else
2237++ {
2238++ if (dwState == NOTHING)
2239++ {
2240++ *pbAccept = TRUE;
2241++ }
2242++ else if (dwState == ACCEPT)
2243++ {
2244++ *pbAccept = FALSE;
2245++ }
2246++ else if (dwState == REJECT)
2247++ {
2248++ *pbAccept = TRUE;
2249++ }
2250++ }
2251++
2252++cleanup:
2253++
2254++ if (xszMin)
2255++ {
2256++ xmlFree(xszMin);
2257++ xszMin = NULL;
2258++ }
2259++ if (xszMax)
2260++ {
2261++ xmlFree(xszMax);
2262++ xszMax = NULL;
2263++ }
2264++ return dwError;
2265++
2266++error:
2267++ goto cleanup;
2268++}
2269++
2270++static
2271++DWORD
2272++CapabilityNormalizeBoolean(
2273++ PCSTR pszValue,
2274++ PDWORD pdwValue
2275++ )
2276++{
2277++ DWORD dwError = 0;
2278++ DWORD dwValue = 0;
2279++
2280++ if (!strcasecmp("true", pszValue) ||
2281++ !strcasecmp("1", pszValue))
2282++ {
2283++ dwValue = 1;
2284++ }
2285++ else if (!strcasecmp("false", pszValue) ||
2286++ !strcasecmp("0", pszValue))
2287++ {
2288++ dwValue = 0;
2289++ }
2290++ else
2291++ {
2292++ fprintf(stderr, "Invalid parameter: Cannot interpret '%s' as boolean\n",
2293++ pszValue);
2294++ dwError = APP_ERROR_INVALID_BOOLEAN;
2295++ BAIL_ON_ERROR(dwError);
2296++ }
2297++
2298++ *pdwValue = dwValue;
2299++
2300++cleanup:
2301++ return dwError;
2302++
2303++error:
2304++ goto cleanup;
2305++}
2306++
2307++DWORD
2308++DefaultValue(
2309++ xmlDocPtr xmlDoc,
2310++ xmlNodePtr pxDefault,
2311++ PSTR *ppszValue
2312++ )
2313++{
2314++ DWORD dwError = 0;
2315++ xmlNodePtr child = NULL;
2316++ xmlChar *xszDefault = NULL;
2317++ DWORD dwLength = 0;
2318++ PSTR pszValue = NULL;
2319++
2320++ if (pxDefault->type != XML_ELEMENT_NODE)
2321++ {
2322++ dwError = ERROR_INVALID_PARAMETER;
2323++ BAIL_ON_ERROR(dwError);
2324++ }
2325++
2326++ dwLength = 0;
2327++ for (child = pxDefault->xmlChildrenNode; child; child = child->next)
2328++ {
2329++ if (child->type != XML_ELEMENT_NODE)
2330++ continue;
2331++
2332++ if (!xmlStrcmp(child->name, (const xmlChar*)"value"))
2333++ {
2334++ xszDefault = xmlNodeListGetString(
2335++ xmlDoc,
2336++ child->xmlChildrenNode,
2337++ TRUE);
2338++
2339++ if (xszDefault)
2340++ dwLength += strlen((PSTR)xszDefault);
2341++ dwLength += 1;
2342++
2343++ xmlFree(xszDefault);
2344++ xszDefault = NULL;
2345++ }
2346++ }
2347++ dwLength += 1;
2348++
2349++ dwError = LwAllocateMemory(dwLength, (PVOID*)&pszValue);
2350++ BAIL_ON_ERROR(dwError);
2351++
2352++ dwLength = 0;
2353++ for (child = pxDefault->xmlChildrenNode; child; child = child->next)
2354++ {
2355++ if (child->type != XML_ELEMENT_NODE)
2356++ continue;
2357++
2358++ if (!xmlStrcmp(child->name, (xmlChar*)"value"))
2359++ {
2360++ xszDefault = xmlNodeListGetString(
2361++ xmlDoc,
2362++ child->xmlChildrenNode,
2363++ TRUE);
2364++ if (xszDefault)
2365++ {
2366++ strcpy(pszValue + dwLength, (PSTR)xszDefault);
2367++ dwLength += strlen((PSTR)xszDefault);
2368++ }
2369++ pszValue[dwLength] = '\0';
2370++ dwLength += 1;
2371++
2372++ xmlFree(xszDefault);
2373++ xszDefault = NULL;
2374++ }
2375++ }
2376++
2377++ *ppszValue = pszValue;
2378++
2379++cleanup:
2380++ xmlFree(xszDefault);
2381++ xszDefault = NULL;
2382++
2383++ return dwError;
2384++
2385++error:
2386++ LW_SAFE_FREE_MEMORY(pszValue);
2387++ goto cleanup;
2388++}
2389++
2390++DWORD
2391++CapabilityEditRegistry(
2392++ PCAPABILITY pCapability,
2393++ PCSTR pszaArg,
2394++ BOOLEAN bVerbose
2395++ )
2396++{
2397++ DWORD dwError = 0;
2398++ DWORD dwValue = 0;
2399++ PREGISTRY pRegistry = NULL;
2400++ DWORD dwType = -1;
2401++ const BYTE *pData = NULL;
2402++ DWORD dwDataSize = 0;
2403++ PSTR pszRoot = NULL;
2404++ PSTR pszKey = NULL;
2405++ PSTR pszName = NULL;
2406++ PSTR pszaValue = NULL;
2407++ PCSTR pszValue = NULL;
2408++ BOOLEAN bUsingDefault = FALSE;
2409++ BOOLEAN bAccept = FALSE;
2410++
2411++ if (!pCapability)
2412++ {
2413++ dwError = ERROR_INVALID_PARAMETER;
2414++ BAIL_ON_ERROR(dwError);
2415++ }
2416++
2417++ if (!pCapability->pRegistry)
2418++ {
2419++ goto cleanup;
2420++ }
2421++
2422++ pRegistry = pCapability->pRegistry;
2423++
2424++ if (pszaArg == NULL)
2425++ {
2426++ if (!pRegistry->pszaDefault)
2427++ {
2428++ fprintf(stderr, "Error: No parameter specified and no default value exist.\n");
2429++ dwError = APP_ERROR_PARAMETER_REQUIRED;
2430++ BAIL_ON_ERROR(dwError);
2431++ }
2432++ else
2433++ {
2434++ pszaArg = pRegistry->pszaDefault;
2435++ bUsingDefault = TRUE;
2436++ }
2437++ }
2438++
2439++ if (!strcmp(pRegistry->pszType, "string"))
2440++ {
2441++ dwError = ValidateString(pszaArg, pCapability->xmlDoc, pRegistry->pxRegistry, &bAccept);
2442++ BAIL_ON_ERROR(dwError);
2443++
2444++ if (!bAccept)
2445++ {
2446++ dwError = APP_ERROR_VALUE_NOT_ACCEPTED;
2447++ BAIL_ON_ERROR(dwError);
2448++ }
2449++ dwType = REG_SZ;
2450++ pData = (const BYTE*) pszaArg;
2451++ dwDataSize = strlen(pszaArg) + 1;
2452++ }
2453++ else if (!strcmp(pRegistry->pszType, "multistring"))
2454++ {
2455++ dwType = REG_MULTI_SZ;
2456++ pData = (const BYTE*) pszaArg;
2457++ dwDataSize = UtilMultistringLength(pszaArg);
2458++ }
2459++ else if (!strcmp(pRegistry->pszType, "dword"))
2460++ {
2461++ dwError = CapabilityNormalizeDword(pszaArg, pRegistry->pxRegistry, &dwValue);
2462++ BAIL_ON_ERROR(dwError);
2463++
2464++ dwError = ValidateDword(dwValue, pRegistry->pxRegistry, &bAccept);
2465++ BAIL_ON_ERROR(dwError);
2466++
2467++ if (!bAccept)
2468++ {
2469++ dwError = APP_ERROR_VALUE_NOT_ACCEPTED;
2470++ BAIL_ON_ERROR(dwError);
2471++ }
2472++
2473++ dwType = REG_DWORD;
2474++ pData = (const BYTE*) &dwValue;
2475++ dwDataSize = sizeof(dwValue);
2476++ }
2477++ else if (!strcmp(pRegistry->pszType, "boolean"))
2478++ {
2479++ dwError = CapabilityNormalizeBoolean(pszaArg, &dwValue);
2480++ BAIL_ON_ERROR(dwError);
2481++
2482++ dwType = REG_DWORD;
2483++ pData = (const BYTE*) &dwValue;
2484++ dwDataSize = sizeof(dwValue);
2485++ }
2486++ else
2487++ {
2488++ fprintf(stderr, "Unknown input type '%s'\n", pRegistry->pszType);
2489++ dwError = APP_ERROR_UNKNOWN_TYPE;
2490++ BAIL_ON_ERROR(dwError);
2491++ }
2492++
2493++ if (bVerbose)
2494++ {
2495++ dwError = GetLocalPolicyValue(pCapability, &pszaValue);
2496++ BAIL_ON_ERROR(dwError);
2497++
2498++ fprintf(stdout, "Current local policy value(s): ");
2499++ if (pszaValue[0] == '\0')
2500++ {
2501++ fprintf(stdout, "\n");
2502++ }
2503++ else
2504++ {
2505++ for (pszValue = pszaValue;
2506++ *pszValue;
2507++ pszValue = pszValue + strlen(pszValue) + 1)
2508++ {
2509++ fprintf(stdout, "%s\n", pszValue);
2510++ }
2511++ }
2512++ }
2513++
2514++ if (bVerbose && bUsingDefault)
2515++ {
2516++ fprintf(stderr, "Using default value(s): ");
2517++ if (pszaArg[0] == '\0')
2518++ {
2519++ fprintf(stdout, "\n");
2520++ }
2521++ else
2522++ {
2523++ for (pszValue = pszaArg;
2524++ *pszValue;
2525++ pszValue = pszValue + strlen(pszValue) + 1)
2526++ {
2527++ fprintf(stdout, "%s\n", pszValue);
2528++ }
2529++ }
2530++ }
2531++
2532++ dwError = UtilParseRegName(
2533++ pRegistry->pszLocalPath,
2534++ &pszRoot,
2535++ &pszKey,
2536++ &pszName);
2537++ BAIL_ON_ERROR(dwError);
2538++
2539++ dwError = UtilSetValueExA(
2540++ pszRoot,
2541++ pszKey,
2542++ pszName,
2543++ dwType,
2544++ pData,
2545++ dwDataSize);
2546++ BAIL_ON_ERROR(dwError);
2547++
2548++cleanup:
2549++
2550++ LW_SAFE_FREE_STRING(pszRoot);
2551++ LW_SAFE_FREE_STRING(pszKey);
2552++ LW_SAFE_FREE_STRING(pszName);
2553++ LW_SAFE_FREE_MEMORY(pszaValue);
2554++
2555++ return dwError;
2556++
2557++error:
2558++ goto cleanup;
2559++}
2560++
2561++DWORD
2562++CapabilityApply(
2563++ PCAPABILITY pCapability,
2564++ BOOLEAN bVerbose
2565++ )
2566++{
2567++ DWORD dwError = 0;
2568++ PREGISTRY pRegistry = NULL;
2569++ xmlNodePtr child = NULL;
2570++ xmlChar *xszCommand = NULL;
2571++ PSTR pszCommand = NULL;
2572++ int ret = 0;
2573++
2574++ if (!pCapability)
2575++ {
2576++ dwError = ERROR_INVALID_PARAMETER;
2577++ BAIL_ON_ERROR(dwError);
2578++ }
2579++
2580++ if (!pCapability->pRegistry)
2581++ {
2582++ goto cleanup;
2583++ }
2584++
2585++ pRegistry = pCapability->pRegistry;
2586++
2587++ for (child = pRegistry->pxRegistry->xmlChildrenNode; child; child =
2588++ child->next)
2589++ {
2590++ if (child->type != XML_ELEMENT_NODE)
2591++ continue;
2592++
2593++ if (!xmlStrcmp(child->name, (const xmlChar*) "apply"))
2594++ {
2595++ xszCommand = xmlGetProp(child, (const xmlChar*)"command");
2596++ if (xszCommand)
2597++ {
2598++ if (bVerbose)
2599++ {
2600++ dwError = LwAllocateStringPrintf(
2601++ &pszCommand,
2602++ "%s",
2603++ (PCSTR)xszCommand);
2604++ }
2605++ else
2606++ {
2607++ dwError = LwAllocateStringPrintf(
2608++ &pszCommand,
2609++ "%s >/dev/null 2>/dev/null",
2610++ (PCSTR)xszCommand);
2611++ }
2612++ BAIL_ON_ERROR(dwError);
2613++
2614++ if (bVerbose)
2615++ fprintf(stdout, "Executing command: %s\n", pszCommand);
2616++
2617++ ret = system((PCSTR)pszCommand);
2618++ if (ret == -1)
2619++ {
2620++ fprintf(stderr, "Problem executing '%s'\n", pszCommand);
2621++ dwError = APP_ERROR_COULD_NOT_FORK;
2622++ }
2623++ else if (ret > 0)
2624++ {
2625++ fprintf(stderr, "Problem executing '%s'\n", pszCommand);
2626++ dwError = APP_ERROR_PROGRAM_ERROR;
2627++ }
2628++
2629++ xmlFree(xszCommand);
2630++ xszCommand = NULL;
2631++
2632++ LW_SAFE_FREE_STRING(pszCommand);
2633++ }
2634++ }
2635++ }
2636++
2637++cleanup:
2638++ LW_SAFE_FREE_STRING(pszCommand);
2639++ xmlFree(xszCommand);
2640++ return dwError;
2641++
2642++error:
2643++ goto cleanup;
2644++}
2645++
2646++static
2647++DWORD
2648++GetLocalPolicyValue(
2649++ PCAPABILITY pCapability,
2650++ PSTR *ppszaValue
2651++ )
2652++{
2653++ DWORD dwError = 0;
2654++ PREGISTRY pRegistry = NULL;
2655++ DWORD dwType = -1;
2656++ const BYTE *pData = NULL;
2657++ DWORD dwDataSize = 0;
2658++ PSTR pszRoot = NULL;
2659++ PSTR pszKey = NULL;
2660++ PSTR pszName = NULL;
2661++ DWORD dwValue = 0;
2662++ PSTR pszaArg = NULL;
2663++ PSTR pszaValue = NULL;
2664++ PSTR pszBuf = NULL;
2665++
2666++ if (!pCapability)
2667++ {
2668++ dwError = ERROR_INVALID_PARAMETER;
2669++ BAIL_ON_ERROR(dwError);
2670++ }
2671++
2672++ if (!pCapability->pRegistry)
2673++ {
2674++ goto cleanup;
2675++ }
2676++
2677++ pRegistry = pCapability->pRegistry;
2678++
2679++ if (!strcmp(pRegistry->pszType, "string"))
2680++ {
2681++ dwType = REG_SZ;
2682++ pData = (const BYTE*) &pszaArg;
2683++ dwDataSize = 0;
2684++ }
2685++ else if (!strcmp(pRegistry->pszType, "multistring"))
2686++ {
2687++ dwType = REG_MULTI_SZ;
2688++ pData = (const BYTE*) &pszaArg;
2689++ dwDataSize = 0;
2690++ }
2691++ else if (!strcmp(pRegistry->pszType, "dword"))
2692++ {
2693++ dwType = REG_DWORD;
2694++ pData = (const BYTE*) &dwValue;
2695++ dwDataSize = sizeof(dwValue);
2696++ }
2697++ else if (!strcmp(pRegistry->pszType, "boolean"))
2698++ {
2699++ dwType = REG_DWORD;
2700++ pData = (const BYTE*) &dwValue;
2701++ dwDataSize = sizeof(dwValue);
2702++ }
2703++ else
2704++ {
2705++ fprintf(stderr, "Unknown input type '%s'\n", pRegistry->pszType);
2706++ dwError = APP_ERROR_UNKNOWN_TYPE;
2707++ BAIL_ON_ERROR(dwError);
2708++ }
2709++
2710++ dwError = UtilParseRegName(
2711++ pRegistry->pszLocalPath,
2712++ &pszRoot,
2713++ &pszKey,
2714++ &pszName);
2715++ BAIL_ON_ERROR(dwError);
2716++
2717++ dwError = UtilGetValueExA(
2718++ pszRoot,
2719++ pszKey,
2720++ pszName,
2721++ dwType,
2722++ (PVOID)pData,
2723++ &dwDataSize);
2724++ BAIL_ON_ERROR(dwError);
2725++
2726++ if (!strcmp(pRegistry->pszType, "boolean"))
2727++ {
2728++ PCSTR pszTrue = "true";
2729++ PCSTR pszFalse = "false";
2730++ dwError = UtilAllocateMultistring(
2731++ dwValue ? &pszTrue : &pszFalse,
2732++ 1,
2733++ &pszaValue);
2734++ BAIL_ON_ERROR(dwError);
2735++ }
2736++ else if (dwType == REG_DWORD)
2737++ {
2738++ dwError = LwAllocateStringPrintf(
2739++ &pszBuf,
2740++ "%lu",
2741++ (unsigned long) dwValue);
2742++ dwError = UtilAllocateMultistring((PCSTR*)&pszBuf, 1, &pszaValue);
2743++ BAIL_ON_ERROR(dwError);
2744++ }
2745++ else if (dwType == REG_SZ)
2746++ {
2747++ dwError = UtilAllocateMultistring((PCSTR*)&pszaArg, 1, &pszaValue);
2748++ BAIL_ON_ERROR(dwError);
2749++ }
2750++ else if (dwType == REG_MULTI_SZ)
2751++ {
2752++ dwError = UtilDuplicateMultistring(pszaArg, &pszaValue);
2753++ BAIL_ON_ERROR(dwError);
2754++ }
2755++
2756++ *ppszaValue = pszaValue;
2757++
2758++cleanup:
2759++
2760++ LW_SAFE_FREE_STRING(pszRoot);
2761++ LW_SAFE_FREE_STRING(pszKey);
2762++ LW_SAFE_FREE_STRING(pszName);
2763++ LW_SAFE_FREE_STRING(pszaArg);
2764++ LW_SAFE_FREE_STRING(pszBuf);
2765++
2766++ return dwError;
2767++
2768++error:
2769++ LW_SAFE_FREE_MEMORY(pszaValue);
2770++ goto cleanup;
2771++
2772++}
2773++
2774++static
2775++DWORD
2776++CapabilityGetRegistry(
2777++ PREGISTRY pRegistry,
2778++ PSTR *ppszaArg,
2779++ PDWORD pdwValue,
2780++ PBOOLEAN pbLocalPolicy
2781++)
2782++{
2783++ DWORD dwError = 0;
2784++ DWORD dwType = -1;
2785++ const BYTE *pData = NULL;
2786++ DWORD dwDataSize = 0;
2787++ PSTR pszRoot = NULL;
2788++ PSTR pszKey = NULL;
2789++ PSTR pszName = NULL;
2790++ BOOLEAN bTryLocalPolicy = TRUE;
2791++
2792++ if (!strcmp(pRegistry->pszType, "string"))
2793++ {
2794++ dwType = REG_SZ;
2795++ pData = (const BYTE*) ppszaArg;
2796++ dwDataSize = 0;
2797++ }
2798++ else if (!strcmp(pRegistry->pszType, "multistring"))
2799++ {
2800++ dwType = REG_MULTI_SZ;
2801++ pData = (const BYTE*) ppszaArg;
2802++ dwDataSize = 0;
2803++ }
2804++ else if (!strcmp(pRegistry->pszType, "dword"))
2805++ {
2806++ dwType = REG_DWORD;
2807++ pData = (const BYTE*) pdwValue;
2808++ dwDataSize = sizeof(*pdwValue);
2809++ }
2810++ else if (!strcmp(pRegistry->pszType, "boolean"))
2811++ {
2812++ dwType = REG_DWORD;
2813++ pData = (const BYTE*) pdwValue;
2814++ dwDataSize = sizeof(*pdwValue);
2815++ }
2816++ else
2817++ {
2818++ fprintf(stderr, "Unknown input type '%s'\n", pRegistry->pszType);
2819++ dwError = APP_ERROR_UNKNOWN_TYPE;
2820++ BAIL_ON_ERROR(dwError);
2821++ }
2822++
2823++ if (pRegistry->pszPolicyPath)
2824++ {
2825++ dwError = UtilParseRegName(
2826++ pRegistry->pszPolicyPath,
2827++ &pszRoot,
2828++ &pszKey,
2829++ &pszName);
2830++ BAIL_ON_ERROR(dwError);
2831++
2832++ dwError = UtilGetValueExA(
2833++ pszRoot,
2834++ pszKey,
2835++ pszName,
2836++ dwType,
2837++ (PVOID) pData,
2838++ &dwDataSize);
2839++ LW_SAFE_FREE_STRING(pszRoot);
2840++ LW_SAFE_FREE_STRING(pszKey);
2841++ LW_SAFE_FREE_STRING(pszName);
2842++
2843++ if (!dwError)
2844++ {
2845++ bTryLocalPolicy = FALSE;
2846++ }
2847++ }
2848++
2849++ if (bTryLocalPolicy)
2850++ {
2851++ dwError = UtilParseRegName(
2852++ pRegistry->pszLocalPath,
2853++ &pszRoot,
2854++ &pszKey,
2855++ &pszName);
2856++ BAIL_ON_ERROR(dwError);
2857++
2858++ dwError = UtilGetValueExA(
2859++ pszRoot,
2860++ pszKey,
2861++ pszName,
2862++ dwType,
2863++ (PVOID)pData,
2864++ &dwDataSize);
2865++ BAIL_ON_ERROR(dwError);
2866++
2867++ *pbLocalPolicy = TRUE;
2868++ }
2869++
2870++error:
2871++ return dwError;
2872++}
2873++
2874++DWORD
2875++CapabilityDump(
2876++ PCAPABILITY pCapability
2877++ )
2878++{
2879++ DWORD dwError = 0;
2880++ PREGISTRY pRegistry = NULL;
2881++ DWORD dwValue = 0;
2882++ PSTR pszaArg = NULL;
2883++ PSTR pszEsc = NULL;
2884++ BOOLEAN bLocalPolicy = FALSE;
2885++
2886++ if (!pCapability)
2887++ {
2888++ dwError = ERROR_INVALID_PARAMETER;
2889++ BAIL_ON_ERROR(dwError);
2890++ }
2891++
2892++ if (!pCapability->pRegistry)
2893++ {
2894++ goto cleanup;
2895++ }
2896++
2897++ pRegistry = pCapability->pRegistry;
2898++
2899++ dwError = CapabilityGetRegistry(pRegistry, &pszaArg, &dwValue, &bLocalPolicy);
2900++ if (dwError == LWREG_ERROR_NO_SUCH_KEY_OR_VALUE)
2901++ {
2902++ dwError = 0;
2903++ goto cleanup;
2904++ }
2905++ BAIL_ON_ERROR(dwError);
2906++
2907++ fprintf(stdout, "%s", pCapability->pszName);
2908++ if (!strcmp(pRegistry->pszType, "boolean"))
2909++ {
2910++ fprintf(stdout, " %s\n", dwValue ? "true" : "false");
2911++ }
2912++ else if (!strcmp(pRegistry->pszType, "dword"))
2913++ {
2914++ fprintf(stdout, " %lu\n", (unsigned long)dwValue);
2915++ }
2916++ else if (!strcmp(pRegistry->pszType, "string"))
2917++ {
2918++ dwError = UtilAllocateEscapedString(pszaArg, &pszEsc);
2919++ BAIL_ON_ERROR(dwError);
2920++
2921++ fprintf(stdout, " \"%s\"\n", pszEsc);
2922++
2923++ LW_SAFE_FREE_STRING(pszEsc);
2924++ }
2925++ else if (!strcmp(pRegistry->pszType, "multistring"))
2926++ {
2927++ PCSTR pszStr = pszaArg;
2928++ while (*pszStr)
2929++ {
2930++ dwError = UtilAllocateEscapedString(pszStr, &pszEsc);
2931++ BAIL_ON_ERROR(dwError);
2932++
2933++ fprintf(stdout, " \"%s\"", pszEsc);
2934++
2935++ LW_SAFE_FREE_STRING(pszEsc);
2936++
2937++ pszStr += strlen(pszStr) + 1;
2938++ }
2939++ fprintf(stdout, "\n");
2940++ }
2941++
2942++cleanup:
2943++
2944++ LW_SAFE_FREE_STRING(pszaArg);
2945++ LW_SAFE_FREE_STRING(pszEsc);
2946++
2947++ return dwError;
2948++
2949++error:
2950++ goto cleanup;
2951++}
2952++
2953++DWORD
2954++CapabilityShow(
2955++ PCAPABILITY pCapability,
2956++ BOOL bConcise
2957++ )
2958++{
2959++ DWORD dwError = 0;
2960++ PREGISTRY pRegistry = NULL;
2961++ DWORD dwValue = 0;
2962++ PSTR pszaArg = NULL;
2963++ PSTR pszEsc = NULL;
2964++ BOOLEAN bRegistryValueFound = FALSE;
2965++ BOOLEAN bLocalPolicy = FALSE;
2966++
2967++ if (!pCapability)
2968++ {
2969++ dwError = ERROR_INVALID_PARAMETER;
2970++ BAIL_ON_ERROR(dwError);
2971++ }
2972++
2973++ if (!pCapability->pRegistry)
2974++ {
2975++ goto cleanup;
2976++ }
2977++
2978++ pRegistry = pCapability->pRegistry;
2979++
2980++ dwError = CapabilityGetRegistry(pRegistry, &pszaArg, &dwValue, &bLocalPolicy);
2981++ if (dwError == 0)
2982++ {
2983++ bRegistryValueFound = TRUE;
2984++ }
2985++ else if (dwError == LWREG_ERROR_NO_SUCH_KEY_OR_VALUE)
2986++ {
2987++ dwError = 0;
2988++ bRegistryValueFound = FALSE;
2989++ }
2990++ BAIL_ON_ERROR(dwError);
2991++
2992++ if (bConcise)
2993++ {
2994++ if (!bRegistryValueFound)
2995++ {
2996++ fprintf(stdout, "missing\n%s\n", pRegistry->pszType);
2997++ }
2998++ else if (!strcmp(pRegistry->pszType, "boolean"))
2999++ {
3000++ fprintf(stdout, "boolean\n%s\n", dwValue ? "true" : "false");
3001++ }
3002++ else if (!strcmp(pRegistry->pszType, "dword"))
3003++ {
3004++ fprintf(stdout, "dword\n%lu\n", (unsigned long) dwValue);
3005++ }
3006++ else if (!strcmp(pRegistry->pszType, "string"))
3007++ {
3008++ fprintf(stdout, "string\n%s\n", pszaArg);
3009++ }
3010++ else if (!strcmp(pRegistry->pszType, "multistring"))
3011++ {
3012++ fprintf(stdout, "multistring\n");
3013++ PCSTR pszStr = pszaArg;
3014++ while (*pszStr)
3015++ {
3016++ fprintf(stdout, "%s\n", pszStr);
3017++ pszStr += strlen(pszStr) + 1;
3018++ }
3019++ fprintf(stdout, "\n");
3020++ }
3021++
3022++ if (bRegistryValueFound)
3023++ {
3024++ if (bLocalPolicy)
3025++ {
3026++ fprintf(stdout, "local policy\n");
3027++ }
3028++ else
3029++ {
3030++ fprintf(stdout, "group policy\n");
3031++ }
3032++ }
3033++ else
3034++ {
3035++ fprintf(stdout, "no policy\n");
3036++ }
3037++ }
3038++ else
3039++ {
3040++ fprintf(stdout, "Name: %s\n", pCapability->pszName);
3041++ fprintf(stdout, "Description: %s\n",
3042++ pCapability->pszDescription ? pCapability->pszDescription : "");
3043++ if (!bRegistryValueFound)
3044++ {
3045++ fprintf(stdout, "Type (Missing From Registry): %s\n",
3046++ pCapability->pRegistry->pszType);
3047++ }
3048++ else
3049++ {
3050++ fprintf(stdout, "Type: %s\n", pCapability->pRegistry->pszType);
3051++ if (!strcmp(pRegistry->pszType, "boolean"))
3052++ {
3053++ fprintf(stdout, "Current Value: %s\n", dwValue ? "true" : "false");
3054++ fprintf(stdout, "Accepted Values: true, false\n");
3055++ }
3056++ else if (!strcmp(pRegistry->pszType, "dword"))
3057++ {
3058++ xmlNodePtr xmlAccept = NULL;
3059++ fprintf(stdout, "Current Value: %lu\n", (unsigned long) dwValue);
3060++
3061++ xmlAccept = FindNext(
3062++ pRegistry->pxRegistry->xmlChildrenNode,
3063++ "accept");
3064++ if (!xmlAccept)
3065++ {
3066++ fprintf(stdout, "Accepted Range: [0, 4294967295]\n");
3067++ }
3068++ while (xmlAccept)
3069++ {
3070++ xmlNodePtr xmlRange = NULL;
3071++
3072++ xmlRange = FindNext(xmlAccept->xmlChildrenNode, "range");
3073++ while(xmlRange)
3074++ {
3075++ xmlChar *xszMin = NULL;
3076++ xmlChar *xszMax = NULL;
3077++
3078++ xszMin = xmlGetProp(xmlRange, (const xmlChar*)"min");
3079++ xszMax = xmlGetProp(xmlRange, (const xmlChar*)"max");
3080++ if (xszMin && xszMax)
3081++ {
3082++ fprintf(stdout,
3083++ "Accepted Range: [%s, %s]\n",
3084++ xszMin,
3085++ xszMax);
3086++ }
3087++ if (xszMin)
3088++ {
3089++ xmlFree(xszMin);
3090++ xszMin = NULL;
3091++ }
3092++ if (xszMax)
3093++ {
3094++ xmlFree(xszMax);
3095++ xszMax = NULL;
3096++ }
3097++ xmlRange = FindNext(xmlRange->next, "range");
3098++ }
3099++ xmlAccept = FindNext(xmlAccept->next, "accept");
3100++ }
3101++ }
3102++ else if (!strcmp(pRegistry->pszType, "string"))
3103++ {
3104++ xmlNodePtr xmlAccept = NULL;
3105++
3106++ dwError = UtilAllocateEscapedString(pszaArg, &pszEsc);
3107++ BAIL_ON_ERROR(dwError);
3108++
3109++ fprintf(stdout, "Current Value: \"%s\"\n", pszEsc);
3110++
3111++ LW_SAFE_FREE_STRING(pszEsc);
3112++
3113++ xmlAccept = FindNext(
3114++ pRegistry->pxRegistry->xmlChildrenNode,
3115++ "accept");
3116++ while (xmlAccept)
3117++ {
3118++ xmlNodePtr xmlValue = NULL;
3119++
3120++ xmlValue = FindNext(xmlAccept->xmlChildrenNode, "value");
3121++ while(xmlValue)
3122++ {
3123++ xmlChar *xszValue = NULL;
3124++
3125++ xszValue = xmlNodeListGetString(
3126++ pCapability->xmlDoc,
3127++ xmlValue->xmlChildrenNode,
3128++ TRUE);
3129++ if (xszValue)
3130++ {
3131++ fprintf(stdout, "Acceptable Value: \"%s\"\n", (PSTR)xszValue);
3132++ xmlFree(xszValue);
3133++ xszValue = NULL;
3134++ }
3135++ xmlValue = FindNext(xmlValue->next, "value");
3136++ }
3137++ xmlAccept = FindNext(xmlAccept->next, "accept");
3138++ }
3139++ }
3140++ else if (!strcmp(pRegistry->pszType, "multistring"))
3141++ {
3142++ fprintf(stdout, "Current Values:\n");
3143++ PCSTR pszStr = pszaArg;
3144++ while (*pszStr)
3145++ {
3146++ dwError = UtilAllocateEscapedString(pszStr, &pszEsc);
3147++ BAIL_ON_ERROR(dwError);
3148++
3149++ fprintf(stdout, "\"%s\"\n", pszEsc);
3150++
3151++ LW_SAFE_FREE_STRING(pszEsc);
3152++
3153++ pszStr += strlen(pszStr) + 1;
3154++ }
3155++ }
3156++
3157++ if (bLocalPolicy)
3158++ fprintf(stdout, "Current Value is determined by local policy.\n");
3159++ else
3160++ fprintf(stdout, "Value is determined by group policy in Active Directory.\n");
3161++ }
3162++ }
3163++cleanup:
3164++
3165++ LW_SAFE_FREE_STRING(pszaArg);
3166++ LW_SAFE_FREE_STRING(pszEsc);
3167++
3168++ return dwError;
3169++
3170++error:
3171++ goto cleanup;
3172++}
3173++
3174++static
3175++xmlNodePtr
3176++FindNext(
3177++ xmlNodePtr pxChild,
3178++ PSTR pszChild)
3179++{
3180++ while (pxChild)
3181++ {
3182++ if (pxChild->type == XML_ELEMENT_NODE)
3183++ {
3184++ if (!xmlStrcmp(pxChild->name, (const xmlChar*)pszChild))
3185++ {
3186++ break;
3187++ }
3188++ }
3189++ pxChild = pxChild->next;
3190++ }
3191++ return pxChild;
3192++}
3193++
3194+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/capability.h likewise-open-6.0.0.53010/lwconfig/src/capability.h
3195+--- likewise-open-6.0.0.53010.old/lwconfig/src/capability.h 1969-12-31 16:00:00.000000000 -0800
3196++++ likewise-open-6.0.0.53010/lwconfig/src/capability.h 2011-01-17 11:51:56.000000000 -0800
3197+@@ -0,0 +1,72 @@
3198++/*
3199++ * Copyright (c) Likewise Software. All rights reserved.
3200++ *
3201++ * This program is free software; you can redistribute it and/or modify
3202++ * it under the terms of the GNU General Public License as published by
3203++ * the Free Software Foundation; either version 2 of the License, or (at
3204++ * your option) any later version.
3205++ *
3206++ * This program is distributed in the hope that it will be useful, but
3207++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3208++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3209++ * for more details. You should have received a copy of the GNU General
3210++ * Public License along with this program. If not, see
3211++ * <http://www.gnu.org/licenses/>.
3212++ *
3213++ * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
3214++ * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
3215++ * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
3216++ * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
3217++ * GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
3218++ * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
3219++ * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
3220++ * license@likewise.com
3221++ */
3222++#ifndef LWCONFIG_CAPABILITY_H
3223++#define LWCONFIG_CAPABILITY_H
3224++
3225++DWORD
3226++CapabilityAllocate(
3227++ xmlDocPtr xmlDoc,
3228++ xmlNodePtr xmlNode,
3229++ PCAPABILITY *ppCapability
3230++ );
3231++
3232++void
3233++CapabilityFree(
3234++ PCAPABILITY pCapability
3235++ );
3236++
3237++DWORD
3238++CapabilityFindByName(
3239++ xmlDocPtr doc,
3240++ PCSTR name,
3241++ PCAPABILITY *ppCapability
3242++ );
3243++
3244++DWORD
3245++CapabilityEditRegistry(
3246++ PCAPABILITY pCapability,
3247++ PCSTR pszaArg,
3248++ BOOLEAN pVerbose
3249++ );
3250++
3251++DWORD
3252++CapabilityApply(
3253++ PCAPABILITY pCapability,
3254++ BOOLEAN bVerbose
3255++ );
3256++
3257++DWORD
3258++CapabilityDump(
3259++ PCAPABILITY pCapability
3260++ );
3261++
3262++DWORD
3263++CapabilityShow(
3264++ PCAPABILITY pCapability,
3265++ BOOL bConcise
3266++ );
3267++
3268++#endif
3269++
3270+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/defs.h likewise-open-6.0.0.53010/lwconfig/src/defs.h
3271+--- likewise-open-6.0.0.53010.old/lwconfig/src/defs.h 1969-12-31 16:00:00.000000000 -0800
3272++++ likewise-open-6.0.0.53010/lwconfig/src/defs.h 2011-01-17 11:51:56.000000000 -0800
3273+@@ -0,0 +1,49 @@
3274++/*
3275++ * Copyright (c) Likewise Software. All rights reserved.
3276++ *
3277++ * This program is free software; you can redistribute it and/or modify
3278++ * it under the terms of the GNU General Public License as published by
3279++ * the Free Software Foundation; either version 2 of the License, or (at
3280++ * your option) any later version.
3281++ *
3282++ * This program is distributed in the hope that it will be useful, but
3283++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3284++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3285++ * for more details. You should have received a copy of the GNU General
3286++ * Public License along with this program. If not, see
3287++ * <http://www.gnu.org/licenses/>.
3288++ *
3289++ * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
3290++ * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
3291++ * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
3292++ * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
3293++ * GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
3294++ * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
3295++ * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
3296++ * license@likewise.com
3297++ */
3298++#ifndef DEFS_H
3299++#define DEFS_H
3300++
3301++#define BAIL_ON_ERROR(x) if (x) goto error
3302++
3303++#define APP_ERROR_BAD_XML 0x20000000
3304++#define APP_ERROR_XML_DUPLICATED_ELEMENT 0x20000001
3305++#define APP_ERROR_XML_MISSING_ELEMENT 0x20000002
3306++#define APP_ERROR_XPATH_EVAL_FAILED 0x20000003
3307++#define APP_ERROR_CAPABILITY_NOT_FOUND 0x20000004
3308++#define APP_ERROR_INVALID_DWORD 0x20000005
3309++#define APP_ERROR_INVALID_BOOLEAN 0x20000006
3310++#define APP_ERROR_UNKNOWN_TYPE 0x20000007
3311++#define APP_ERROR_INVALID_SUFFIX 0x20000008
3312++#define APP_ERROR_PARAMETER_REQUIRED 0x20000009
3313++#define APP_ERROR_UNEXPECTED_VALUE 0x2000000a
3314++#define APP_ERROR_COULD_NOT_FORK 0x2000000b
3315++#define APP_ERROR_INVALID_ESCAPE_SEQUENCE 0x2000000c
3316++#define APP_ERROR_UNTERMINATED_QUOTE 0x2000000d
3317++#define APP_ERROR_BAD_REGISTRY_PATH 0x2000000e
3318++#define APP_ERROR_VALUE_NOT_ACCEPTED 0x2000000f
3319++#define APP_ERROR_PROGRAM_ERROR 0x20000010
3320++#define APP_ERROR_CAPABILITY_MULTIPLE_MATCHES 0x20000011
3321++#define APP_ERROR_XML_MISSING_ATTRIBUTE 0x20000012
3322++#endif
3323+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/includes.h likewise-open-6.0.0.53010/lwconfig/src/includes.h
3324+--- likewise-open-6.0.0.53010.old/lwconfig/src/includes.h 1969-12-31 16:00:00.000000000 -0800
3325++++ likewise-open-6.0.0.53010/lwconfig/src/includes.h 2011-01-17 11:51:56.000000000 -0800
3326+@@ -0,0 +1,53 @@
3327++/*
3328++ * Copyright (c) Likewise Software. All rights reserved.
3329++ *
3330++ * This program is free software; you can redistribute it and/or modify
3331++ * it under the terms of the GNU General Public License as published by
3332++ * the Free Software Foundation; either version 2 of the License, or (at
3333++ * your option) any later version.
3334++ *
3335++ * This program is distributed in the hope that it will be useful, but
3336++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3337++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3338++ * for more details. You should have received a copy of the GNU General
3339++ * Public License along with this program. If not, see
3340++ * <http://www.gnu.org/licenses/>.
3341++ *
3342++ * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
3343++ * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
3344++ * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
3345++ * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
3346++ * GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
3347++ * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
3348++ * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
3349++ * license@likewise.com
3350++ */
3351++#include "config.h"
3352++
3353++#include <stdlib.h>
3354++#include <stdio.h>
3355++#include <string.h>
3356++#include <assert.h>
3357++#include <unistd.h>
3358++#include <errno.h>
3359++#include <sys/types.h>
3360++#include <regex.h>
3361++#include <locale.h>
3362++
3363++#include <libxml/tree.h>
3364++#include <libxml/parser.h>
3365++#include <libxml/xpath.h>
3366++#include <libxml/xpathInternals.h>
3367++
3368++#include <reg/lwreg.h>
3369++#include <reg/regutil.h>
3370++
3371++#include <lwstr.h>
3372++#include <lwmem.h>
3373++#include <lwerror.h>
3374++
3375++#include "defs.h"
3376++#include "structs.h"
3377++#include "util.h"
3378++#include "capability.h"
3379++
3380+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/main.c likewise-open-6.0.0.53010/lwconfig/src/main.c
3381+--- likewise-open-6.0.0.53010.old/lwconfig/src/main.c 1969-12-31 16:00:00.000000000 -0800
3382++++ likewise-open-6.0.0.53010/lwconfig/src/main.c 2011-01-17 11:51:56.000000000 -0800
3383+@@ -0,0 +1,545 @@
3384++/*
3385++ * Copyright (c) Likewise Software. All rights reserved.
3386++ *
3387++ * This program is free software; you can redistribute it and/or modify
3388++ * it under the terms of the GNU General Public License as published by
3389++ * the Free Software Foundation; either version 2 of the License, or (at
3390++ * your option) any later version.
3391++ *
3392++ * This program is distributed in the hope that it will be useful, but
3393++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3394++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3395++ * for more details. You should have received a copy of the GNU General
3396++ * Public License along with this program. If not, see
3397++ * <http://www.gnu.org/licenses/>.
3398++ *
3399++ * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
3400++ * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
3401++ * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
3402++ * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
3403++ * GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
3404++ * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
3405++ * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
3406++ * license@likewise.com
3407++ */
3408++
3409++#include "includes.h"
3410++
3411++DWORD
3412++SetOperation(
3413++ xmlDocPtr doc,
3414++ PCSTR pszName,
3415++ PCSTR pszaArg,
3416++ BOOLEAN bVerbose
3417++ );
3418++
3419++DWORD
3420++ShowOperation(
3421++ xmlDocPtr doc,
3422++ PCSTR pszName,
3423++ BOOLEAN bConcise
3424++ );
3425++
3426++static
3427++void
3428++PrintUsage()
3429++{
3430++ fputs(
3431++"Usage: lwconfig [OPTIONS] [COMMAND]\n"
3432++"Modify or view the configuration.\n"
3433++"\n"
3434++" Options:\n"
3435++" --verbose Display additional information.\n"
3436++"\n"
3437++" Commands:\n"
3438++" SETTING [VALUE] Change SETTING to the given VALUE(s) or the\n"
3439++" default value if no value is specified.\n"
3440++" --list Display names of all settings.\n"
3441++" --show SETTING Display current value(s) of SETTING.\n"
3442++" --detail SETTING Display current value(s) and details of SETTING.\n"
3443++" --file FILE Read FILE with each line beginning with a\n"
3444++" setting name followed by value(s). Use '.'\n"
3445++" for reading from stdin.\n"
3446++" --dump Dump all settings in a format suitable for use\n"
3447++" with --file.\n"
3448++ ,stderr);
3449++}
3450++
3451++DWORD
3452++ListCapabilities(
3453++ xmlDocPtr doc
3454++ )
3455++{
3456++ DWORD dwError = 0;
3457++ xmlXPathContextPtr xpathCtx = NULL;
3458++ xmlXPathObjectPtr xpathObj = NULL;
3459++ xmlNodeSetPtr nodes = NULL;
3460++ size_t i;
3461++
3462++ xpathCtx = xmlXPathNewContext(doc);
3463++ if (!xpathCtx)
3464++ {
3465++ dwError = ERROR_OUTOFMEMORY;
3466++ BAIL_ON_ERROR(dwError);
3467++ }
3468++
3469++ xpathObj = xmlXPathEvalExpression(
3470++ (const xmlChar*)"/capabilities/section",
3471++ xpathCtx);
3472++ if (!xpathObj)
3473++ {
3474++ dwError = APP_ERROR_XPATH_EVAL_FAILED;
3475++ BAIL_ON_ERROR(dwError);
3476++ }
3477++
3478++ nodes = xpathObj->nodesetval;
3479++ for (i = 0; i < nodes->nodeNr; i++)
3480++ {
3481++ if (nodes->nodeTab[i]->type == XML_ELEMENT_NODE)
3482++ {
3483++ xmlNodePtr cur = nodes->nodeTab[i];
3484++ xmlNodePtr child = NULL;
3485++ xmlChar *section = NULL;
3486++
3487++ section = xmlGetProp(cur, (const xmlChar*) "section");
3488++ if (section)
3489++ fprintf(stdout, "[%s]\n", section);
3490++ else
3491++ fprintf(stdout, "\n");
3492++ xmlFree(section);
3493++ section = NULL;
3494++
3495++ for (child = cur->xmlChildrenNode; child; child = child->next)
3496++ {
3497++ PCAPABILITY cap = NULL;
3498++ if (child->type != XML_ELEMENT_NODE)
3499++ continue;
3500++ if (xmlStrcmp(child->name, (const xmlChar*)"capability"))
3501++ continue;
3502++
3503++ dwError = CapabilityAllocate(doc, child, &cap);
3504++ BAIL_ON_ERROR(dwError);
3505++
3506++ if (cap->pszName)
3507++ fprintf(stdout, "\t%s\n", cap->pszName);
3508++
3509++ CapabilityFree(cap);
3510++ cap = NULL;
3511++ }
3512++ }
3513++ }
3514++
3515++cleanup:
3516++ xmlXPathFreeObject(xpathObj);
3517++ xmlXPathFreeContext(xpathCtx);
3518++ return dwError;
3519++
3520++error:
3521++ goto cleanup;
3522++}
3523++
3524++DWORD
3525++SetOperation(
3526++ xmlDocPtr doc,
3527++ PCSTR pszName,
3528++ PCSTR pszaArg,
3529++ BOOLEAN bVerbose
3530++ )
3531++{
3532++ DWORD dwError = 0;
3533++ PCAPABILITY pCapability = NULL;
3534++
3535++ dwError = CapabilityFindByName(doc, pszName, &pCapability);
3536++ BAIL_ON_ERROR(dwError);
3537++
3538++ dwError = CapabilityEditRegistry(pCapability, pszaArg, bVerbose);
3539++ BAIL_ON_ERROR(dwError);
3540++
3541++ dwError = CapabilityApply(pCapability, bVerbose);
3542++ BAIL_ON_ERROR(dwError);
3543++
3544++cleanup:
3545++ CapabilityFree(pCapability);
3546++ return dwError;
3547++
3548++error:
3549++ goto cleanup;
3550++}
3551++
3552++DWORD
3553++ShowOperation(
3554++ xmlDocPtr doc,
3555++ PCSTR pszName,
3556++ BOOLEAN bConcise
3557++ )
3558++{
3559++ DWORD dwError = 0;
3560++ PCAPABILITY pCapability = NULL;
3561++
3562++ dwError = CapabilityFindByName(doc, pszName, &pCapability);
3563++ BAIL_ON_ERROR(dwError);
3564++
3565++ dwError = CapabilityShow(pCapability, bConcise);
3566++ BAIL_ON_ERROR(dwError);
3567++
3568++cleanup:
3569++ CapabilityFree(pCapability);
3570++ return dwError;
3571++
3572++error:
3573++ goto cleanup;
3574++}
3575++
3576++DWORD
3577++DumpOperation(
3578++ xmlDocPtr doc,
3579++ BOOLEAN bPolicyOnly
3580++ )
3581++{
3582++ DWORD dwError = 0;
3583++ PCAPABILITY pCapability = NULL;
3584++ xmlXPathContextPtr xpathCtx = NULL;
3585++ xmlXPathObjectPtr xpathObj = NULL;
3586++ xmlNodeSetPtr nodes = NULL;
3587++ size_t i;
3588++
3589++ xpathCtx = xmlXPathNewContext(doc);
3590++ if (!xpathCtx)
3591++ {
3592++ dwError = ERROR_OUTOFMEMORY;
3593++ BAIL_ON_ERROR(dwError);
3594++ }
3595++
3596++ xpathObj = xmlXPathEvalExpression(
3597++ (const xmlChar*)"/capabilities/section/capability",
3598++ xpathCtx);
3599++ if (!xpathObj)
3600++ {
3601++ dwError = APP_ERROR_XPATH_EVAL_FAILED;
3602++ BAIL_ON_ERROR(dwError);
3603++ }
3604++
3605++ nodes = xpathObj->nodesetval;
3606++ for (i = 0; i < nodes->nodeNr; i++)
3607++ {
3608++ if (nodes->nodeTab[i]->type != XML_ELEMENT_NODE)
3609++ continue;
3610++
3611++ if (xmlStrcmp(nodes->nodeTab[i]->name, (const xmlChar*)"capability"))
3612++ continue;
3613++
3614++ dwError = CapabilityAllocate(doc, nodes->nodeTab[i], &pCapability);
3615++ BAIL_ON_ERROR(dwError);
3616++
3617++ dwError = CapabilityDump(pCapability);
3618++ BAIL_ON_ERROR(dwError);
3619++
3620++ CapabilityFree(pCapability);
3621++ pCapability = NULL;
3622++ }
3623++
3624++cleanup:
3625++ CapabilityFree(pCapability);
3626++ pCapability = NULL;
3627++ xmlXPathFreeObject(xpathObj);
3628++ xmlXPathFreeContext(xpathCtx);
3629++ return dwError;
3630++
3631++error:
3632++ goto cleanup;
3633++}
3634++
3635++int main(int argc, const char *argv[])
3636++{
3637++ DWORD dwError = 0;
3638++ BOOLEAN bListCapabilities = FALSE;
3639++ BOOLEAN bFile = FALSE;
3640++ PCSTR pszFile = NULL;
3641++ BOOLEAN bShowCapability = FALSE;
3642++ BOOLEAN bDumpCapability = FALSE;
3643++ BOOLEAN bDetailCapability = FALSE;
3644++ BOOLEAN bVerbose = FALSE;
3645++ PCSTR pszCapability = NULL;
3646++ FILE *fpFile = NULL;
3647++ PSTR pszLine = NULL;
3648++ PSTR *ppszArgs = NULL;
3649++ DWORD dwArgs = 0;
3650++ PSTR pszaArg = NULL;
3651++ xmlDocPtr doc = NULL;
3652++ int dwArgc = 1;
3653++ int returnErrorCode = 1;
3654++ size_t i;
3655++
3656++ setlocale(LC_ALL, "");
3657++
3658++ xmlInitParser();
3659++
3660++ doc = xmlParseFile(LWCONFIG_XML);
3661++ if (!doc)
3662++ {
3663++ dwError = APP_ERROR_BAD_XML;
3664++ BAIL_ON_ERROR(dwError);
3665++ }
3666++
3667++ if (argc == 1)
3668++ {
3669++ PrintUsage();
3670++ goto cleanup;
3671++ }
3672++
3673++ for (dwArgc = 1; dwArgc < argc; dwArgc++)
3674++ {
3675++ if (!strcmp(argv[dwArgc], "--help"))
3676++ {
3677++ PrintUsage();
3678++ goto cleanup;
3679++ }
3680++ else if (!strcmp(argv[dwArgc], "--file"))
3681++ {
3682++ if (argc == dwArgc+1)
3683++ {
3684++ PrintUsage();
3685++ goto cleanup;
3686++ }
3687++
3688++ bFile = TRUE;
3689++ pszFile = argv[++dwArgc];
3690++ }
3691++ else if (!strcmp(argv[dwArgc], "--list"))
3692++ {
3693++ bListCapabilities = TRUE;
3694++ }
3695++ else if (!strcmp(argv[dwArgc], "--dump"))
3696++ {
3697++ bDumpCapability = TRUE;
3698++ }
3699++ else if (!strcmp(argv[dwArgc], "--show"))
3700++ {
3701++ if (argc == dwArgc+1)
3702++ {
3703++ PrintUsage();
3704++ goto cleanup;
3705++ }
3706++
3707++ bShowCapability = TRUE;
3708++ pszCapability = argv[++dwArgc];
3709++ }
3710++ else if (!strcmp(argv[dwArgc], "--detail") ||
3711++ !strcmp(argv[dwArgc], "--details"))
3712++ {
3713++ if (argc == dwArgc+1)
3714++ {
3715++ PrintUsage();
3716++ goto cleanup;
3717++ }
3718++ bDetailCapability = TRUE;
3719++ pszCapability = argv[++dwArgc];
3720++ }
3721++ else if (!strcmp(argv[dwArgc], "--verbose"))
3722++ {
3723++ bVerbose = TRUE;
3724++ }
3725++ else if (!strncmp(argv[dwArgc], "--", 2))
3726++ {
3727++ PrintUsage();
3728++ goto cleanup;
3729++ }
3730++ else
3731++ break;
3732++ }
3733++
3734++ if (bListCapabilities)
3735++ {
3736++ dwError = ListCapabilities(doc);
3737++ BAIL_ON_ERROR(dwError);
3738++ }
3739++ else if (bDumpCapability)
3740++ {
3741++ dwError = DumpOperation(doc, TRUE);
3742++ BAIL_ON_ERROR(dwError);
3743++ }
3744++ else if (bFile)
3745++ {
3746++ if (!strcmp(pszFile, "."))
3747++ fpFile = stdin;
3748++ else if ((fpFile = fopen(pszFile, "r")) == NULL)
3749++ {
3750++ dwError = LwMapErrnoToLwError(errno);
3751++ BAIL_ON_ERROR(dwError);
3752++ }
3753++
3754++ while ((dwError = UtilReadLine(fpFile, &pszLine)) == 0)
3755++ {
3756++ dwError = UtilParseLine(pszLine, &ppszArgs, &dwArgs);
3757++ BAIL_ON_ERROR(dwError);
3758++
3759++ if (dwArgs > 0)
3760++ {
3761++ dwError = UtilAllocateMultistring((PCSTR*)ppszArgs + 1, dwArgs -
3762++ 1, &pszaArg);
3763++ BAIL_ON_ERROR(dwError);
3764++
3765++ dwError = SetOperation(doc, ppszArgs[0], pszaArg, bVerbose);
3766++ BAIL_ON_ERROR(dwError);
3767++
3768++ for (i = 0; i < dwArgs; i++)
3769++ LW_SAFE_FREE_MEMORY(ppszArgs[i]);
3770++ dwArgs = 0;
3771++ LW_SAFE_FREE_MEMORY(ppszArgs);
3772++ LW_SAFE_FREE_MEMORY(pszaArg);
3773++ }
3774++
3775++ LW_SAFE_FREE_STRING(pszLine);
3776++ }
3777++ if (dwError == ERROR_HANDLE_EOF)
3778++ {
3779++ dwError = 0;
3780++ }
3781++ BAIL_ON_ERROR(dwError);
3782++ }
3783++ else if (bShowCapability || bDetailCapability)
3784++ {
3785++ dwError = ShowOperation(doc, pszCapability, bShowCapability);
3786++ BAIL_ON_ERROR(dwError);
3787++ }
3788++ else
3789++ {
3790++ if (argc - dwArgc > 0)
3791++ {
3792++ if (argc - dwArgc > 1)
3793++ {
3794++ dwError = UtilAllocateMultistring((PCSTR*)argv + dwArgc + 1,
3795++ argc - dwArgc - 1, &pszaArg);
3796++ BAIL_ON_ERROR(dwError);
3797++ }
3798++
3799++ dwError = SetOperation(doc, argv[dwArgc], pszaArg, bVerbose);
3800++ BAIL_ON_ERROR(dwError);
3801++ }
3802++ else
3803++ {
3804++ PrintUsage();
3805++ goto cleanup;
3806++ }
3807++ }
3808++
3809++cleanup:
3810++
3811++ LW_SAFE_FREE_MEMORY(pszaArg);
3812++
3813++ for (i = 0; i < dwArgs; i++)
3814++ LW_SAFE_FREE_MEMORY(ppszArgs[i]);
3815++ dwArgs = 0;
3816++ LW_SAFE_FREE_MEMORY(ppszArgs);
3817++
3818++ if (fpFile && fpFile != stdin)
3819++ {
3820++ fclose(fpFile);
3821++ fpFile = NULL;
3822++ }
3823++ xmlFreeDoc(doc);
3824++ doc = NULL;
3825++
3826++ xmlCleanupParser();
3827++ if (dwError)
3828++ {
3829++ size_t size = 0;
3830++ char buf[1024];
3831++
3832++ buf[0] = '\0';
3833++
3834++ if (_LW_ERROR_REG_BASE <= dwError && dwError <= _LW_ERROR_REG_MAX)
3835++ {
3836++ size = LwRegGetErrorString(dwError, buf, sizeof(buf));
3837++ if (size > sizeof(buf))
3838++ buf[0] = '\0';
3839++ }
3840++ else if (dwError >= 0x20000000)
3841++ {
3842++ switch(dwError)
3843++ {
3844++ case APP_ERROR_XML_DUPLICATED_ELEMENT:
3845++ strcpy(buf, "Duplicated XML element");
3846++ break;
3847++ case APP_ERROR_XML_MISSING_ELEMENT:
3848++ strcpy(buf, "Missing XML element");
3849++ break;
3850++ case APP_ERROR_XPATH_EVAL_FAILED:
3851++ strcpy(buf, "Could not evaluate XPath expression");
3852++ break;
3853++ case APP_ERROR_CAPABILITY_NOT_FOUND:
3854++ strcpy(buf, "Capability not found");
3855++ returnErrorCode = 2;
3856++ break;
3857++ case APP_ERROR_INVALID_DWORD:
3858++ strcpy(buf, "Could not interpret value as dword");
3859++ returnErrorCode = 3;
3860++ break;
3861++ case APP_ERROR_INVALID_BOOLEAN:
3862++ strcpy(buf, "Could not interpret value as boolean");
3863++ returnErrorCode = 3;
3864++ break;
3865++ case APP_ERROR_INVALID_SUFFIX:
3866++ strcpy(buf, "Suffix on DWORD does not match known units");
3867++ returnErrorCode = 3;
3868++ break;
3869++ case APP_ERROR_PARAMETER_REQUIRED:
3870++ strcpy(buf, "Argument required -- no default is present");
3871++ returnErrorCode = 4;
3872++ break;
3873++ case APP_ERROR_UNEXPECTED_VALUE:
3874++ strcpy(buf, "Bad value in /var/lib/likewise/lwconfig.xml");
3875++ break;
3876++ case APP_ERROR_COULD_NOT_FORK:
3877++ strcpy(buf, "Could not fork");
3878++ break;
3879++ case APP_ERROR_BAD_XML:
3880++ strcpy(buf, "Malformed XML in /var/lib/likewise/lwconfig.xml");
3881++ break;
3882++ case APP_ERROR_INVALID_ESCAPE_SEQUENCE:
3883++ strcpy(buf, "Bad escape sequence");
3884++ returnErrorCode = 3;
3885++ break;
3886++ case APP_ERROR_UNTERMINATED_QUOTE:
3887++ strcpy(buf, "Unterminated quote");
3888++ returnErrorCode = 3;
3889++ break;
3890++ case APP_ERROR_VALUE_NOT_ACCEPTED:
3891++ strcpy(buf, "Value not in accepted range");
3892++ returnErrorCode = 3;
3893++ break;
3894++ case APP_ERROR_PROGRAM_ERROR:
3895++ strcpy(buf, "Error returned by external program");
3896++ returnErrorCode = 5;
3897++ break;
3898++ case APP_ERROR_CAPABILITY_MULTIPLE_MATCHES:
3899++ strcpy(buf, "Multiple capabilties matched; aborting.");
3900++ returnErrorCode = 6;
3901++ break;
3902++ case APP_ERROR_XML_MISSING_ATTRIBUTE:
3903++ strcpy(buf, "Missing XML attribute");
3904++ break;
3905++ }
3906++ }
3907++ if (buf[0] == '\0')
3908++ {
3909++ size = LwGetErrorString(dwError, buf, sizeof(buf));
3910++ if (size > sizeof(buf))
3911++ buf[0] = '\0';
3912++ }
3913++
3914++ if (buf[0])
3915++ {
3916++ fprintf(stderr, "Error: %s\n", buf);
3917++ }
3918++ else
3919++ {
3920++ fprintf(stderr, "Error: %lu\n", (unsigned long) dwError);
3921++ }
3922++ return returnErrorCode;
3923++ }
3924++ return 0;
3925++
3926++error:
3927++ goto cleanup;
3928++}
3929+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/Makefile.am likewise-open-6.0.0.53010/lwconfig/src/Makefile.am
3930+--- likewise-open-6.0.0.53010.old/lwconfig/src/Makefile.am 1969-12-31 16:00:00.000000000 -0800
3931++++ likewise-open-6.0.0.53010/lwconfig/src/Makefile.am 2011-02-23 18:41:56.000000000 -0800
3932+@@ -0,0 +1,19 @@
3933++bin_PROGRAMS = lwconfig
3934++
3935++lwconfig_SOURCES = \
3936++ capability.c \
3937++ main.c \
3938++ util.c
3939++
3940++lwconfig_CPPFLAGS = \
3941++ $(AM_CPPFLAGS) \
3942++ -I$(top_srcdir)/include \
3943++ $(XML2_INCLUDES) \
3944++ $(LWBASE_INCLUDES)
3945++
3946++lwconfig_LDADD = \
3947++ $(XML2_LIBS) \
3948++ $(LWBASE_LIBS) \
3949++ $(LWADVAPI_LIBS) \
3950++ $(LWREG_LIBS) \
3951++ -lregclient -lregcommon -llwadvapi_nothr
3952+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/structs.h likewise-open-6.0.0.53010/lwconfig/src/structs.h
3953+--- likewise-open-6.0.0.53010.old/lwconfig/src/structs.h 1969-12-31 16:00:00.000000000 -0800
3954++++ likewise-open-6.0.0.53010/lwconfig/src/structs.h 2011-01-17 11:51:56.000000000 -0800
3955+@@ -0,0 +1,48 @@
3956++/*
3957++ * Copyright (c) Likewise Software. All rights reserved.
3958++ *
3959++ * This program is free software; you can redistribute it and/or modify
3960++ * it under the terms of the GNU General Public License as published by
3961++ * the Free Software Foundation; either version 2 of the License, or (at
3962++ * your option) any later version.
3963++ *
3964++ * This program is distributed in the hope that it will be useful, but
3965++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3966++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3967++ * for more details. You should have received a copy of the GNU General
3968++ * Public License along with this program. If not, see
3969++ * <http://www.gnu.org/licenses/>.
3970++ *
3971++ * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
3972++ * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
3973++ * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
3974++ * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
3975++ * GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
3976++ * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
3977++ * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
3978++ * license@likewise.com
3979++ */
3980++
3981++#ifndef LWCONFIG_STRUCTS_H
3982++#define LWCONFIG_STRUCTS_H
3983++
3984++typedef struct _REGISTRY
3985++{
3986++ xmlNodePtr pxRegistry;
3987++ PSTR pszLocalPath;
3988++ PSTR pszPolicyPath;
3989++ PSTR pszType;
3990++ PSTR pszDescription;
3991++ PSTR pszaDefault;
3992++} REGISTRY, *PREGISTRY;
3993++
3994++typedef struct _CAPABILITY
3995++{
3996++ xmlDocPtr xmlDoc;
3997++ xmlNodePtr xmlNodeCapability;
3998++ PSTR pszName;
3999++ PSTR pszDescription;
4000++ PREGISTRY pRegistry;
4001++} CAPABILITY, *PCAPABILITY;
4002++
4003++#endif
4004+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/util.c likewise-open-6.0.0.53010/lwconfig/src/util.c
4005+--- likewise-open-6.0.0.53010.old/lwconfig/src/util.c 1969-12-31 16:00:00.000000000 -0800
4006++++ likewise-open-6.0.0.53010/lwconfig/src/util.c 2011-01-17 11:51:56.000000000 -0800
4007+@@ -0,0 +1,660 @@
4008++/*
4009++* Copyright (c) Likewise Software. All rights reserved.
4010++*
4011++* This program is free software; you can redistribute it and/or modify
4012++* it under the terms of the GNU General Public License as published by
4013++* the Free Software Foundation; either version 2 of the License, or (at
4014++* your option) any later version.
4015++*
4016++* This program is distributed in the hope that it will be useful, but
4017++* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
4018++* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4019++* for more details. You should have received a copy of the GNU General
4020++* Public License along with this program. If not, see
4021++* <http://www.gnu.org/licenses/>.
4022++*
4023++* LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
4024++* TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
4025++* WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
4026++* TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
4027++* GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
4028++* HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
4029++* TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
4030++* license@likewise.com
4031++*/
4032++
4033++#include "includes.h"
4034++
4035++DWORD
4036++UtilAllocateMultistring(
4037++ PCSTR *ppszValues,
4038++ DWORD dwValues,
4039++ PSTR *ppszValue
4040++ )
4041++{
4042++ DWORD dwError = 0;
4043++ DWORD dwLength = 0;
4044++ PSTR pszValue = NULL;
4045++ size_t i;
4046++
4047++ if (dwValues)
4048++ {
4049++ for (i = 0; i < dwValues; i++)
4050++ {
4051++ dwLength += strlen(ppszValues[i]) + 1;
4052++ }
4053++ dwLength++;
4054++
4055++
4056++ dwError = LwAllocateMemory(dwLength, (PVOID*)&pszValue);
4057++ BAIL_ON_ERROR(dwError);
4058++
4059++ dwLength = 0;
4060++ for (i = 0; i < dwValues; i++)
4061++ {
4062++ strcpy(pszValue + dwLength, ppszValues[i]);
4063++ dwLength += strlen(ppszValues[i]) + 1;
4064++ }
4065++ pszValue[dwLength++] = '\0';
4066++ }
4067++
4068++ *ppszValue = pszValue;
4069++
4070++cleanup:
4071++ return dwError;
4072++
4073++error:
4074++ LW_SAFE_FREE_MEMORY(pszValue);
4075++ goto cleanup;
4076++}
4077++
4078++DWORD
4079++UtilMultistringLength(
4080++ PCSTR pszValue
4081++ )
4082++{
4083++ PCSTR pszEnd = NULL;
4084++
4085++ pszEnd = pszValue;
4086++ while (*pszEnd)
4087++ {
4088++ pszEnd = pszEnd + strlen(pszEnd) + 1;
4089++ }
4090++
4091++ return (pszEnd - pszValue) + 1;
4092++}
4093++
4094++DWORD
4095++UtilDuplicateMultistring(
4096++ PCSTR pszValue,
4097++ PSTR *ppszValue
4098++ )
4099++{
4100++ DWORD dwError = 0;
4101++ DWORD dwLength = 0;
4102++ PSTR pszOut = NULL;
4103++
4104++ dwLength = UtilMultistringLength(pszValue);
4105++
4106++ dwError = LwAllocateMemory(dwLength, (PVOID*)&pszOut);
4107++ BAIL_ON_ERROR(dwError);
4108++
4109++ memcpy(pszOut, pszValue, dwLength);
4110++
4111++ *ppszValue = pszOut;
4112++
4113++cleanup:
4114++ return dwError;
4115++
4116++error:
4117++ LW_SAFE_FREE_MEMORY(pszOut);
4118++ goto cleanup;
4119++}
4120++
4121++DWORD
4122++UtilParseRegName(
4123++ PCSTR pszPath,
4124++ PSTR *ppszRoot,
4125++ PSTR *ppszKey,
4126++ PSTR *ppszName
4127++ )
4128++{
4129++ DWORD dwError = 0;
4130++ PSTR pszRoot = NULL;
4131++ PSTR pszKey = NULL;
4132++ PSTR pszName = NULL;
4133++ PCSTR pszFirst = NULL;
4134++ PCSTR pszLast = NULL;
4135++ PCSTR pszEnd = NULL;
4136++
4137++ if (!pszPath)
4138++ {
4139++ dwError = APP_ERROR_BAD_REGISTRY_PATH;
4140++ BAIL_ON_ERROR(dwError);
4141++ }
4142++
4143++ // Skip past a leading /
4144++ if (pszPath[0] == '\\')
4145++ pszPath++;
4146++
4147++ // Find the end of the string (before the terminator).
4148++ pszEnd = pszPath + strlen(pszPath) - 1;
4149++
4150++ pszFirst = strchr(pszPath, '\\');
4151++ if (!pszFirst)
4152++ {
4153++ dwError = APP_ERROR_BAD_REGISTRY_PATH;
4154++ BAIL_ON_ERROR(dwError);
4155++ }
4156++
4157++ pszLast = strrchr(pszPath, '\\');
4158++
4159++ dwError = LwAllocateMemory(pszFirst - pszPath + 1, (PVOID*) &pszRoot);
4160++ BAIL_ON_ERROR(dwError);
4161++
4162++ memcpy(pszRoot, pszPath, pszFirst - pszPath);
4163++ pszRoot[pszFirst - pszPath] = '\0';
4164++
4165++ if (pszFirst != pszLast)
4166++ {
4167++ dwError = LwAllocateMemory(pszLast - pszFirst + 1, (PVOID*) &pszKey);
4168++ BAIL_ON_ERROR(dwError);
4169++
4170++ memcpy(pszKey, pszFirst + 1, (pszLast - pszFirst) - 1);
4171++ pszKey[pszLast - pszFirst] = '\0';
4172++ }
4173++
4174++ dwError = LwAllocateMemory(pszEnd - pszLast + 1, (PVOID*) &pszName);
4175++ BAIL_ON_ERROR(dwError);
4176++
4177++ memcpy(pszName, pszLast + 1, pszEnd - pszLast);
4178++ pszName[pszEnd - pszLast] = '\0';
4179++
4180++ *ppszRoot = pszRoot;
4181++ *ppszKey = pszKey;
4182++ *ppszName = pszName;
4183++
4184++cleanup:
4185++ return dwError;
4186++
4187++error:
4188++ LW_SAFE_FREE_STRING(pszRoot);
4189++ LW_SAFE_FREE_STRING(pszKey);
4190++ LW_SAFE_FREE_STRING(pszName);
4191++ goto cleanup;
4192++}
4193++
4194++DWORD
4195++UtilSetValueExA(
4196++ PCSTR pszRoot,
4197++ PCSTR pszKey,
4198++ PCSTR pszValueName,
4199++ DWORD dwType,
4200++ const BYTE *pData,
4201++ DWORD cbData
4202++ )
4203++{
4204++ DWORD dwError = 0;
4205++ HANDLE hReg = NULL;
4206++ HKEY hRootKey = NULL;
4207++ HKEY hKeyKey = NULL;
4208++
4209++ dwError = LwRegOpenServer(&hReg);
4210++ BAIL_ON_ERROR(dwError);
4211++
4212++ if (!strcmp(pszRoot, "HKEY_THIS_MACHINE"))
4213++ {
4214++ dwError = LwRegOpenKeyExA(hReg, NULL, HKEY_THIS_MACHINE, 0, KEY_WRITE, &hRootKey);
4215++ BAIL_ON_ERROR(dwError);
4216++ }
4217++ else
4218++ {
4219++ dwError = LW_ERROR_INVALID_PARAMETER;
4220++ BAIL_ON_ERROR(dwError);
4221++ }
4222++
4223++ if (pszKey && pszKey[0])
4224++ {
4225++ dwError = LwRegOpenKeyExA(hReg, hRootKey, pszKey, 0, KEY_WRITE,
4226++ &hKeyKey);
4227++ BAIL_ON_ERROR(dwError);
4228++ }
4229++ else
4230++ {
4231++ hKeyKey = hRootKey;
4232++ hRootKey = NULL;
4233++ }
4234++
4235++ dwError = LwRegSetValueExA(hReg, hKeyKey, pszValueName, 0, dwType, pData, cbData);
4236++ BAIL_ON_ERROR(dwError);
4237++
4238++cleanup:
4239++ if (hKeyKey)
4240++ {
4241++ LwRegCloseKey(hReg, hKeyKey);
4242++ hKeyKey = NULL;
4243++ }
4244++
4245++ if (hRootKey)
4246++ {
4247++ LwRegCloseKey(hReg, hRootKey);
4248++ hRootKey = NULL;
4249++ }
4250++
4251++ if (hReg)
4252++ {
4253++ LwRegCloseServer(hReg);
4254++ hReg = NULL;
4255++ }
4256++
4257++ return dwError;
4258++
4259++error:
4260++ goto cleanup;
4261++}
4262++
4263++DWORD
4264++UtilGetValueExA(
4265++ PCSTR pszRoot,
4266++ PCSTR pszKey,
4267++ PCSTR pszValueName,
4268++ DWORD dwType,
4269++ PVOID *ppvData,
4270++ PDWORD pcbData
4271++ )
4272++{
4273++ DWORD dwError = 0;
4274++ DWORD dwActualType = 0;
4275++ PSTR pszValue = NULL;
4276++ char szValue[MAX_VALUE_LENGTH];
4277++ DWORD cbData = sizeof(szValue);
4278++ HANDLE hReg = NULL;
4279++ HKEY hRootKey = NULL;
4280++ HKEY hKeyKey = NULL;
4281++
4282++ dwError = LwRegOpenServer(&hReg);
4283++ BAIL_ON_ERROR(dwError);
4284++
4285++ if (!strcmp(pszRoot, "HKEY_THIS_MACHINE"))
4286++ {
4287++ dwError = LwRegOpenKeyExA(hReg, NULL, HKEY_THIS_MACHINE, 0, KEY_READ, &hRootKey);
4288++ BAIL_ON_ERROR(dwError);
4289++ }
4290++ else
4291++ {
4292++ dwError = LW_ERROR_INVALID_PARAMETER;
4293++ BAIL_ON_ERROR(dwError);
4294++ }
4295++
4296++ if (pszKey && pszKey[0])
4297++ {
4298++ dwError = LwRegOpenKeyExA(hReg, hRootKey, pszKey, 0, KEY_READ,
4299++ &hKeyKey);
4300++ BAIL_ON_ERROR(dwError);
4301++ }
4302++ else
4303++ {
4304++ hKeyKey = hRootKey;
4305++ hRootKey = NULL;
4306++ }
4307++
4308++ dwError = LwRegQueryValueExA(hReg, hKeyKey, pszValueName, 0, &dwActualType,
4309++ (PBYTE)szValue, &cbData);
4310++ BAIL_ON_ERROR(dwError);
4311++
4312++ if (dwActualType != dwType)
4313++ {
4314++ dwError = ERROR_INVALID_PARAMETER;
4315++ BAIL_ON_ERROR(dwError);
4316++ }
4317++
4318++ if (dwType == REG_DWORD && cbData == sizeof(REG_DWORD))
4319++ {
4320++ memcpy(ppvData, szValue, sizeof(REG_DWORD));
4321++ *pcbData = sizeof(REG_DWORD);
4322++ }
4323++ else if (dwType == REG_SZ)
4324++ {
4325++ dwError = LwAllocateString(szValue, &pszValue);
4326++ BAIL_ON_ERROR(dwError);
4327++
4328++ *ppvData = pszValue;
4329++ *pcbData = cbData;
4330++ }
4331++ else if (dwType == REG_MULTI_SZ)
4332++ {
4333++ dwError = LwAllocateMemory(cbData, (PVOID*)&pszValue);
4334++ BAIL_ON_ERROR(dwError);
4335++
4336++ memcpy(pszValue, szValue, cbData);
4337++
4338++ *ppvData = pszValue;
4339++ *pcbData = cbData;
4340++ }
4341++ else
4342++ {
4343++ dwError = ERROR_INVALID_PARAMETER;
4344++ BAIL_ON_ERROR(dwError);
4345++ }
4346++
4347++
4348++cleanup:
4349++ if (hKeyKey)
4350++ {
4351++ LwRegCloseKey(hReg, hKeyKey);
4352++ hKeyKey = NULL;
4353++ }
4354++
4355++ if (hRootKey)
4356++ {
4357++ LwRegCloseKey(hReg, hRootKey);
4358++ hRootKey = NULL;
4359++ }
4360++
4361++ if (hReg)
4362++ {
4363++ LwRegCloseServer(hReg);
4364++ hReg = NULL;
4365++ }
4366++
4367++ return dwError;
4368++
4369++error:
4370++ LW_SAFE_FREE_MEMORY(pszValue);
4371++ goto cleanup;
4372++}
4373++
4374++static
4375++DWORD
4376++AppendCharacter(int c, PSTR *ppszLine, PDWORD pdwMaxSize)
4377++{
4378++ DWORD dwError = 0;
4379++ PSTR pszLine = NULL;
4380++ DWORD dwMaxSize = 0;
4381++ size_t i = 0;
4382++
4383++ if (*ppszLine)
4384++ for (i = 0; (*ppszLine)[i]; i++)
4385++ ;
4386++
4387++ if (!*ppszLine || i + 1 == *pdwMaxSize)
4388++ {
4389++ dwMaxSize = *pdwMaxSize + 16; // Not doing exponential growth
4390++ dwError = LwAllocateMemory(sizeof(char) * dwMaxSize, (PVOID*)&pszLine);
4391++ BAIL_ON_ERROR(dwError);
4392++
4393++ memcpy(pszLine, *ppszLine, *pdwMaxSize);
4394++
4395++ LW_SAFE_FREE_STRING(*ppszLine);
4396++ *ppszLine = pszLine;
4397++ pszLine = NULL;
4398++ *pdwMaxSize = dwMaxSize;
4399++ }
4400++ (*ppszLine)[i] = c;
4401++ (*ppszLine)[i+1] = '\0';
4402++
4403++cleanup:
4404++ return dwError;
4405++
4406++error:
4407++ LW_SAFE_FREE_STRING(pszLine);
4408++ goto cleanup;
4409++}
4410++
4411++static
4412++DWORD
4413++AppendArgument(PSTR pszLine, PSTR **pppszArgs, PDWORD pdwArgs)
4414++{
4415++ DWORD dwError = 0;
4416++ PSTR pszNewLine = NULL;
4417++ PSTR *ppszArgs = NULL;
4418++ DWORD dwArgs = 0;
4419++
4420++ dwError = LwAllocateString(pszLine, &pszNewLine);
4421++ BAIL_ON_ERROR(dwError);
4422++
4423++ dwArgs = *pdwArgs + 1;
4424++ dwError = LwAllocateMemory(sizeof(PSTR) * dwArgs, (PVOID*)&ppszArgs);
4425++ BAIL_ON_ERROR(dwError);
4426++
4427++ memcpy(ppszArgs, *pppszArgs, *pdwArgs * sizeof(*ppszArgs));
4428++ ppszArgs[*pdwArgs] = pszNewLine;
4429++ pszNewLine = NULL;
4430++
4431++ LW_SAFE_FREE_MEMORY(*pppszArgs);
4432++ *pppszArgs = ppszArgs;
4433++ ppszArgs = NULL;
4434++
4435++ *pdwArgs = dwArgs;
4436++
4437++cleanup:
4438++ return dwError;
4439++
4440++error:
4441++ LW_SAFE_FREE_STRING(pszNewLine);
4442++ goto cleanup;
4443++}
4444++
4445++DWORD
4446++UtilParseLine(
4447++ PCSTR pszLine,
4448++ PSTR **pppszArgs,
4449++ PDWORD pdwArgs
4450++ )
4451++{
4452++ DWORD dwError = 0;
4453++ PSTR pszArg = NULL;
4454++ DWORD dwArgMaxSize = 0;
4455++ PSTR *ppszArgs = NULL;
4456++ DWORD dwArgs = 0;
4457++ BOOLEAN bArgument = FALSE;
4458++ BOOLEAN bQuoted = FALSE;
4459++ BOOLEAN bEscaped = FALSE;
4460++ size_t i = 0;
4461++
4462++ dwArgMaxSize = 64;
4463++ dwError = LwAllocateMemory(sizeof(char) * dwArgMaxSize, (PVOID*)&pszArg);
4464++ BAIL_ON_ERROR(dwError);
4465++
4466++ for (i = 0; pszLine[i] && pszLine[i] != '\n' && pszLine[i] != '\r'; i++)
4467++ {
4468++ int c = pszLine[i];
4469++
4470++ if (!bArgument)
4471++ {
4472++ if (c == ' ' || c == '\t')
4473++ continue;
4474++ }
4475++ bArgument = TRUE;
4476++
4477++ if (bEscaped)
4478++ {
4479++ dwError = AppendCharacter(c, &pszArg, &dwArgMaxSize);
4480++ BAIL_ON_ERROR(dwError);
4481++ bEscaped = FALSE;
4482++ }
4483++ else if (c == '\\')
4484++ {
4485++ bEscaped = TRUE;
4486++ }
4487++ else if (bQuoted)
4488++ {
4489++ if (c == '"')
4490++ {
4491++ bQuoted = FALSE;
4492++ bArgument = FALSE;
4493++
4494++ // Terminate argument
4495++ dwError = AppendArgument(pszArg, &ppszArgs, &dwArgs);
4496++ BAIL_ON_ERROR(dwError);
4497++ pszArg[0] = '\0';
4498++ }
4499++ else
4500++ {
4501++ dwError = AppendCharacter(c, &pszArg, &dwArgMaxSize);
4502++ BAIL_ON_ERROR(dwError);
4503++ }
4504++ }
4505++ else if (c == '"')
4506++ {
4507++ bQuoted = TRUE;
4508++
4509++ // Terminate previous argument if there was one.
4510++ if (pszArg && pszArg[0])
4511++ {
4512++ dwError = AppendArgument(pszArg, &ppszArgs, &dwArgs);
4513++ BAIL_ON_ERROR(dwError);
4514++ pszArg[0] = '\0';
4515++ }
4516++ }
4517++ else if (c == ' ' || c == '\t')
4518++ {
4519++ bArgument = FALSE;
4520++
4521++ // Terminate previous argument
4522++ dwError = AppendArgument(pszArg, &ppszArgs, &dwArgs);
4523++ BAIL_ON_ERROR(dwError);
4524++ pszArg[0] = '\0';
4525++ }
4526++ else
4527++ {
4528++ dwError = AppendCharacter(c, &pszArg, &dwArgMaxSize);
4529++ BAIL_ON_ERROR(dwError);
4530++ }
4531++ }
4532++
4533++ if (bEscaped)
4534++ {
4535++ dwError = APP_ERROR_INVALID_ESCAPE_SEQUENCE;
4536++ BAIL_ON_ERROR(dwError);
4537++ }
4538++ if (bQuoted)
4539++ {
4540++ dwError = APP_ERROR_UNTERMINATED_QUOTE;
4541++ BAIL_ON_ERROR(dwError);
4542++ }
4543++ if (pszArg[0])
4544++ {
4545++ dwError = AppendArgument(pszArg, &ppszArgs, &dwArgs);
4546++ BAIL_ON_ERROR(dwError);
4547++ }
4548++
4549++ *pppszArgs = ppszArgs;
4550++ *pdwArgs = dwArgs;
4551++
4552++cleanup:
4553++ LW_SAFE_FREE_STRING(pszArg);
4554++ return dwError;
4555++
4556++error:
4557++
4558++ LW_SAFE_FREE_STRING(pszArg);
4559++ for (i = 0; i < dwArgs; i++)
4560++ {
4561++ LW_SAFE_FREE_STRING(ppszArgs[i]);
4562++ }
4563++ LW_SAFE_FREE_MEMORY(ppszArgs);
4564++ goto cleanup;
4565++}
4566++
4567++DWORD
4568++UtilReadLine(
4569++ FILE* pStream,
4570++ PSTR* ppszLine
4571++ )
4572++{
4573++ DWORD dwError = 0;
4574++ ssize_t sSize = 0, sCapacity = 0;
4575++ PSTR pszBuffer = NULL;
4576++ // Do not free
4577++ PSTR pszNewBuffer = NULL;
4578++
4579++ do
4580++ {
4581++ // There is not enough space. Allocate a larger buffer
4582++ sCapacity = sSize*2 + 10;
4583++ dwError = LwReallocMemory(
4584++ pszBuffer,
4585++ OUT_PPVOID(&pszNewBuffer),
4586++ sCapacity + 1);
4587++ BAIL_ON_ERROR(dwError);
4588++ pszBuffer = pszNewBuffer;
4589++
4590++ // Read as much as the stream will give us up to the space in the
4591++ // buffer.
4592++ errno = 0;
4593++ if (fgets(pszBuffer + sSize, sCapacity - sSize, pStream) == NULL)
4594++ {
4595++ dwError = LwMapErrnoToLwError(errno);
4596++ if (dwError == 0)
4597++ {
4598++ dwError = ERROR_HANDLE_EOF;
4599++ }
4600++ BAIL_ON_ERROR(dwError);
4601++ }
4602++
4603++ sSize += strlen(pszBuffer + sSize);
4604++ }
4605++ // While the whole buffer is used and it does not end in a newline
4606++ while(sSize == sCapacity - 1 && pszBuffer[sSize-1] != '\n');
4607++
4608++ if (sSize == 0)
4609++ {
4610++ dwError = ERROR_HANDLE_EOF;
4611++ BAIL_ON_ERROR(dwError);
4612++ }
4613++ if (pszBuffer[sSize-1] == '\n')
4614++ pszBuffer[sSize-1] = '\0';
4615++
4616++ *ppszLine = pszBuffer;
4617++
4618++cleanup:
4619++ return dwError;
4620++
4621++error:
4622++ LW_SAFE_FREE_STRING(pszBuffer);
4623++ goto cleanup;
4624++}
4625++
4626++DWORD
4627++UtilAllocateEscapedString(
4628++ PCSTR pszStr,
4629++ PSTR *ppszEscapedStr
4630++ )
4631++{
4632++ DWORD dwError = 0;
4633++ const PCSTR pszEscapeChars = "\\\"";
4634++ DWORD i, j;
4635++ PSTR pszEscapedStr = NULL;
4636++ DWORD dwCount = 0;
4637++
4638++ for (i = 0; pszStr[i]; i++)
4639++ {
4640++ if (strchr(pszEscapeChars, pszStr[i]) != NULL)
4641++ dwCount++;
4642++ dwCount++;
4643++ }
4644++ dwCount++;
4645++
4646++ dwError = LwAllocateMemory(dwCount, (PVOID)&pszEscapedStr);
4647++ BAIL_ON_ERROR(dwError);
4648++
4649++ for (i = 0, j = 0; pszStr[i]; i++)
4650++ {
4651++ if (strchr(pszEscapeChars, pszStr[i]) != NULL)
4652++ {
4653++ pszEscapedStr[j++] = '\\';
4654++ }
4655++ pszEscapedStr[j++] = pszStr[i];
4656++ }
4657++ pszEscapedStr[j] = '\0';
4658++
4659++ *ppszEscapedStr = pszEscapedStr;
4660++
4661++cleanup:
4662++ return dwError;
4663++
4664++error:
4665++ LW_SAFE_FREE_MEMORY(pszEscapedStr);
4666++ goto cleanup;
4667++}
4668+diff -Nurb likewise-open-6.0.0.53010.old/lwconfig/src/util.h likewise-open-6.0.0.53010/lwconfig/src/util.h
4669+--- likewise-open-6.0.0.53010.old/lwconfig/src/util.h 1969-12-31 16:00:00.000000000 -0800
4670++++ likewise-open-6.0.0.53010/lwconfig/src/util.h 2011-01-17 11:51:56.000000000 -0800
4671+@@ -0,0 +1,95 @@
4672++/*
4673++* Copyright (c) Likewise Software. All rights reserved.
4674++*
4675++* This program is free software; you can redistribute it and/or modify
4676++* it under the terms of the GNU General Public License as published by
4677++* the Free Software Foundation; either version 2 of the License, or (at
4678++* your option) any later version.
4679++*
4680++* This program is distributed in the hope that it will be useful, but
4681++* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
4682++* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4683++* for more details. You should have received a copy of the GNU General
4684++* Public License along with this program. If not, see
4685++* <http://www.gnu.org/licenses/>.
4686++*
4687++* LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
4688++* TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
4689++* WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
4690++* TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
4691++* GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU
4692++* HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
4693++* TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
4694++* license@likewise.com
4695++*/
4696++#ifndef LWCONFIG_UTIL_H
4697++#define LWCONFIG_UTIL_H
4698++
4699++#include "includes.h"
4700++
4701++DWORD
4702++UtilAllocateMultistring(
4703++ PCSTR *ppszValues,
4704++ DWORD dwValues,
4705++ PSTR *ppszValue
4706++ );
4707++
4708++DWORD
4709++UtilMultistringLength(
4710++ PCSTR pszValue
4711++ );
4712++
4713++DWORD
4714++UtilDuplicateMultistring(
4715++ PCSTR pszValue,
4716++ PSTR *ppszValue
4717++ );
4718++
4719++DWORD
4720++UtilParseRegName(
4721++ PCSTR pszPath,
4722++ PSTR *ppszRoot,
4723++ PSTR *ppszKey,
4724++ PSTR *ppszValueName
4725++ );
4726++
4727++DWORD
4728++UtilSetValueExA(
4729++ PCSTR pszRoot,
4730++ PCSTR pszKey,
4731++ PCSTR pszValueName,
4732++ DWORD dwType,
4733++ const BYTE *pData,
4734++ DWORD cbData
4735++ );
4736++
4737++DWORD
4738++UtilGetValueExA(
4739++ PCSTR pszRoot,
4740++ PCSTR pszKey,
4741++ PCSTR pszValueName,
4742++ DWORD dwType,
4743++ PVOID *ppvData,
4744++ PDWORD pcbData
4745++ );
4746++
4747++DWORD
4748++UtilParseLine(
4749++ PCSTR pszLine,
4750++ PSTR **pppszArgs,
4751++ PDWORD pdwArgs
4752++ );
4753++
4754++DWORD
4755++UtilReadLine(
4756++ FILE* pStream,
4757++ PSTR* ppszLine
4758++ );
4759++
4760++DWORD
4761++UtilAllocateEscapedString(
4762++ PCSTR pszStr,
4763++ PSTR *ppszEscapedStr
4764++ );
4765++
4766++#endif
4767
4768=== modified file 'debian/patches/series'
4769--- debian/patches/series 2011-02-10 11:15:29 +0000
4770+++ debian/patches/series 2011-02-24 20:14:14 +0000
4771@@ -18,3 +18,4 @@
4772 use_offsetof.diff
4773 add-dependencies-1.diff
4774 add-dependencies-2.diff
4775+add-missing-lwconfig.diff
4776
4777=== modified file 'debian/rules'
4778--- debian/rules 2011-01-24 15:57:30 +0000
4779+++ debian/rules 2011-02-24 20:14:14 +0000
4780@@ -48,8 +48,8 @@
4781 for f in lwbase lwmsg \
4782 lwreg pstore lwadvapi centutils netlogon lwio lwsm libschannel \
4783 dcerpc eventlog lsass lwdns \
4784- domainjoin srvsvc lwnetapi lwtools lwupgrade; do \
4785- echo $$f && (cd $$f && ./autogen.sh) || exit 1;\
4786+ domainjoin srvsvc lwnetapi lwtools lwconfig lwupgrade; do \
4787+ echo $$f && (cd $$f && chmod +x ./autogen.sh && ./autogen.sh) || exit 1;\
4788 done
4789 find . -type d -name autom4te.cache | xargs /bin/rm -rf
4790 touch configure-stamp
4791@@ -62,7 +62,7 @@
4792 for comp in lwbase lwmsg \
4793 lwreg pstore lwadvapi centutils netlogon lwio lwsm libschannel \
4794 dcerpc eventlog lsass lwdns \
4795- domainjoin srvsvc lwnetapi lwtools lwupgrade; do \
4796+ domainjoin srvsvc lwnetapi lwtools lwconfig lwupgrade; do \
4797 env BUILD_LOCALSTATEDIR=$(LOCALSTATEDIR) \
4798 BUILD_SYSCONFDIR=$(SYSCONFDIR) \
4799 BUILD_LIBDIR="lib/$(PKGNAME)" \

Subscribers

People subscribed via source and target branches

to all changes: