Author: jkupec
Date: Wed Apr 23 14:22:09 2008
New Revision: 9803
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9803&view=rev
Log:
- zypp-refresh-wrapper (SUID wrapper) added
- zypp-checkpatches{-wrapper} is now deprecated
Added:
trunk/zypper/src/zypp-refresh-wrapper.c (contents, props changed)
- copied, changed from r9801, trunk/zypper/src/zypp-checkpatches-wrapper.c
Modified:
trunk/zypper/src/CMakeLists.txt
trunk/zypper/src/zypp-checkpatches-wrapper.c
trunk/zypper/zypper.spec.cmake
Modified: trunk/zypper/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/CMakeLists.txt?rev=9803&r1=9802&r2=9803&view=diff
==============================================================================
--- trunk/zypper/src/CMakeLists.txt (original)
+++ trunk/zypper/src/CMakeLists.txt Wed Apr 23 14:22:09 2008
@@ -77,30 +77,45 @@
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/zypper/xml
)
+
+# zypp-checkpatches utility
+# DEPRECATED - use zypp-refresh + 'zypper --xmlout lu' instead
ADD_EXECUTABLE( zypp-checkpatches zypp-checkpatches.cc zypper-updates.cc )
TARGET_LINK_LIBRARIES( zypp-checkpatches ${ZYPP_LIBRARY} )
-
-ADD_EXECUTABLE( zypp-refresh zypp-refresh.cc )
-TARGET_LINK_LIBRARIES( zypp-refresh ${ZYPP_LIBRARY} )
INSTALL(
TARGETS zypp-checkpatches
RUNTIME DESTINATION ${INSTALL_PREFIX}/sbin
)
+ADD_EXECUTABLE( zypp-checkpatches-wrapper zypp-checkpatches-wrapper.c )
+TARGET_LINK_LIBRARIES( zypp-checkpatches-wrapper ${ZYPP_LIBRARY} )
INSTALL(
- FILES bash-completion.sh
- DESTINATION ${SYSCONFDIR}/bash_completion.d
- RENAME zypper.sh
+ TARGETS zypp-checkpatches-wrapper
+ RUNTIME DESTINATION ${INSTALL_PREFIX}/sbin
)
-ADD_EXECUTABLE( zypp-checkpatches-wrapper zypp-checkpatches-wrapper.c )
-TARGET_LINK_LIBRARIES( zypp-checkpatches-wrapper ${ZYPP_LIBRARY} )
+# zypp-refresh utility
+ADD_EXECUTABLE( zypp-refresh zypp-refresh.cc )
+TARGET_LINK_LIBRARIES( zypp-refresh ${ZYPP_LIBRARY} )
+INSTALL(
+ TARGETS zypp-refresh
+ RUNTIME DESTINATION ${INSTALL_PREFIX}/sbin
+)
+ADD_EXECUTABLE( zypp-refresh-wrapper zypp-refresh-wrapper.c )
+TARGET_LINK_LIBRARIES( zypp-refresh-wrapper ${ZYPP_LIBRARY} )
INSTALL(
- TARGETS zypp-checkpatches-wrapper
+ TARGETS zypp-refresh-wrapper
RUNTIME DESTINATION ${INSTALL_PREFIX}/sbin
)
+# bash completion script
+INSTALL(
+ FILES bash-completion.sh
+ DESTINATION ${SYSCONFDIR}/bash_completion.d
+ RENAME zypper.sh
+)
+
# installation_sources script
INSTALL(
Modified: trunk/zypper/src/zypp-checkpatches-wrapper.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypp-checkpatches-wrapper.c?rev=9803&r1=9802&r2=9803&view=diff
==============================================================================
--- trunk/zypper/src/zypp-checkpatches-wrapper.c (original)
+++ trunk/zypper/src/zypp-checkpatches-wrapper.c Wed Apr 23 14:22:09 2008
@@ -24,6 +24,12 @@
int main (void)
{
+ fprintf (stderr, "WARNING: Since zypper 0.11.1, this program is"
+ " deprecated and will be dropped for openSUSE 11.1.\n\n"
+ " Use zypp-refresh-wrapper as a replacement, followed by any regular"
+ " zypper query command. To check for patches, execute"
+ " 'zypper --xmlout lu' after executing zypp-refresh-wrapper.\n");
+
/* see http://rechner.lst.de/~okir/blackhats/node41.html */
while (1) {
int fd = open("/dev/null", O_RDWR);
Copied: trunk/zypper/src/zypp-refresh-wrapper.c (from r9801, trunk/zypper/src/zypp-checkpatches-wrapper.c)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypp-refresh-wrapper.c?p2=trunk/zypper/src/zypp-refresh-wrapper.c&p1=trunk/zypper/src/zypp-checkpatches-wrapper.c&r1=9801&r2=9803&rev=9803&view=diff
==============================================================================
--- trunk/zypper/src/zypp-checkpatches-wrapper.c (original)
+++ trunk/zypper/src/zypp-refresh-wrapper.c Wed Apr 23 14:22:09 2008
@@ -1,7 +1,6 @@
-/* A setuid-root wrapper for zypper refresh repositories */
+/* A setuid-root wrapper for zypp-refresh utility */
/* setgid, umask and open */
-#include
#include
#include
#include
@@ -14,80 +13,92 @@
#define WRAPPER_ERROR 101
-const char *app = "/usr/bin/zypper";
-const char *arg1 = "--non-interactive";
-const char *arg2 = "--xmlout";
-const char *arg3 = "-q";
-const char *arg4 = "xu";
+const char *app = "/usr/sbin/zypp-refresh";
+/* const char *arg1 = ""; */
char *lang = NULL;
int main (void)
{
- /* see http://rechner.lst.de/~okir/blackhats/node41.html */
- while (1) {
- int fd = open("/dev/null", O_RDWR);
- if (fd < 0)
- return WRAPPER_ERROR;
- if (fd > 2) {
- close(fd);
- break;
- }
- }
-
- /* see http://rechner.lst.de/~okir/blackhats/node35.html */
- int fd = getdtablesize();
- while (fd-- > 2)
+ /* see http://rechner.lst.de/~okir/blackhats/node41.html */
+ while (1)
+ {
+ int fd = open("/dev/null", O_RDWR);
+ if (fd < 0)
+ return WRAPPER_ERROR;
+ if (fd > 2) {
close(fd);
-
- /* cd / to avoid NFS problems */
- if (chdir ("/")) {
- perror ("chdir");
- return WRAPPER_ERROR;
+ break;
}
+ }
- /* save language */
- lang = getenv("LANG");
+ /* see http://rechner.lst.de/~okir/blackhats/node35.html */
+ int fd = getdtablesize();
+ while (fd-- > 2)
+ close(fd);
+
+ /* cd / to avoid NFS problems */
+ if (chdir ("/"))
+ {
+ perror ("chdir");
+ return WRAPPER_ERROR;
+ }
- /* do not look at argv... done */
- /* clear environment */
- if (clearenv ()) {
- fprintf (stderr, "clearenv failed\n");
- return WRAPPER_ERROR;
- }
+ /* save language */
+ lang = getenv("LANG");
+
+ /* do not look at argv... done */
+ /* clear environment */
+ if (clearenv ())
+ {
+ fprintf (stderr, "clearenv failed\n");
+ return WRAPPER_ERROR;
+ }
- /* set minimal environment... done */
- /* prevent the user from sending signals */
+ /* set minimal environment... done */
+ /* prevent the user from sending signals */
- if (initgroups("root", 0) != 0 || setgid (0) != 0) {
- fprintf (stdout, "<?xml version='1.0'?>\n");
- fprintf (stdout, "<stream>\n");
- fprintf (stdout, "Unable to check for patches and updates because /usr/sbin/zypp-checkpatches-wrapper helper programm is not set SUID root.\nThis problem might be solved by setting \"File Permissons\" in YaST \"Local Security\" tab to \"easy\" or by modifying /etc/permissions.local</message>\n");
- fprintf (stdout, "</stream>\n");
- return WRAPPER_ERROR;
- }
+ if (initgroups("root", 0) != 0 || setgid (0) != 0)
+ {
+ fprintf (stdout, "<?xml version='1.0'?>\n");
+ fprintf (stdout, "<stream>\n");
+ fprintf (stdout, ""
+ "Unable to refresh repositories because /usr/sbin/zypp-refresh-wrapper"
+ " helper programm is not set SUID root.\n"
+ "This problem might be solved by setting \"File Permissons\" in YaST"
+ " \"Local Security\" tab to \"easy\" or by modifying"
+ " /etc/permissions.local</message>\n");
+ fprintf (stdout, "</stream>\n");
+ return WRAPPER_ERROR;
+ }
- if (setuid (0) != 0) {
-// perror ("setuid");
-// fprintf (stderr, "Forgot to chmod this program?\n");
- fprintf (stdout, "<?xml version='1.0'?>\n");
- fprintf (stdout, "<stream>\n");
- fprintf (stdout, "Unable to check for patches and updates because /usr/sbin/zypp-checkpatches-wrapper helper programm is not set SUID root.\nThis problem might be solved by setting \"File Permissons\" in YaST \"Local Security\" tab to \"easy\" or by modifying /etc/permissions.local</message>\n");
- fprintf (stdout, "</stream>\n");
- return WRAPPER_ERROR;
- }
+ if (setuid (0) != 0)
+ {
+ // perror ("setuid");
+ // fprintf (stderr, "Forgot to chmod this program?\n");
+ fprintf (stdout, "<?xml version='1.0'?>\n");
+ fprintf (stdout, "<stream>\n");
+ fprintf (stdout, "Unable to refresh repositories"
+ " because /usr/sbin/zypp-refresh-wrapper helper programm is not set"
+ " SUID root.\n"
+ "This problem might be solved by setting \"File Permissons\" in YaST"
+ " \"Local Security\" tab to \"easy\" or by modifying"
+ " /etc/permissions.local</message>\n");
+ fprintf (stdout, "</stream>\n");
+ return WRAPPER_ERROR;
+ }
- umask(0022);
+ umask(0022);
- /* set language */
- if (lang != NULL)
- setenv("LANG", lang, 1);
+ /* set language */
+ if (lang != NULL)
+ setenv("LANG", lang, 1);
- /* execute the real application */
- execl (app, app, arg1, arg2, arg3, arg4, (char *) NULL);
+ /* execute the real application */
+ execl (app, app, (char *) NULL);
- /* if we are still here, it has failed */
- perror ("exec");
- return WRAPPER_ERROR;
+ /* if we are still here, it has failed */
+ perror ("execl");
+ return WRAPPER_ERROR;
}
Modified: trunk/zypper/zypper.spec.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/zypper.spec.cmake?rev=9803&r1=9802&r2=9803&view=diff
==============================================================================
--- trunk/zypper/zypper.spec.cmake (original)
+++ trunk/zypper/zypper.spec.cmake Wed Apr 23 14:22:09 2008
@@ -90,6 +90,8 @@
%{_bindir}/installation_sources
%{_sbindir}/zypp-checkpatches
%verify(not mode) %attr (755,root,root) %{_sbindir}/zypp-checkpatches-wrapper
+%{_sbindir}/zypp-refresh
+%verify(not mode) %attr (755,root,root) %{_sbindir}/zypp-refresh-wrapper
%dir %{prefix}/share/zypper
%dir %{prefix}/share/zypper/xml
%{prefix}/share/zypper/xml/xmlout.rnc
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org