aboutsummaryrefslogtreecommitdiff
path: root/src/util/os_installation.c
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2017-02-24 20:10:46 +0100
committertg(x) <*@tg-x.net>2017-02-24 20:10:46 +0100
commitb7002d3f8016478d716236238bd43a7c06c924d2 (patch)
tree3a37e4ffc3dfbb53c7dd571b85126ec762ffbbae /src/util/os_installation.c
parentcb1165ecfc5c89c22aa4a6fffb72e27e0bde43a3 (diff)
parentfa0b5c44f096a68ac0a51c4cbb37c920ceb36bce (diff)
downloadgnunet-b7002d3f8016478d716236238bd43a7c06c924d2.tar.gz
gnunet-b7002d3f8016478d716236238bd43a7c06c924d2.zip
Merge branch 'master' of gnunet.org:gnunet
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r--src/util/os_installation.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index caceeea0c..1226c5966 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -823,9 +823,13 @@ GNUNET_OS_check_helper_binary (const char *binary,
823#ifdef MINGW 823#ifdef MINGW
824 char *binaryexe; 824 char *binaryexe;
825 825
826 GNUNET_asprintf (&binaryexe, "%s.exe", binary); 826 GNUNET_asprintf (&binaryexe,
827 if ( (GNUNET_YES == GNUNET_STRINGS_path_is_absolute (binaryexe, GNUNET_NO, 827 "%s.exe",
828 NULL, NULL)) || 828 binary);
829 if ( (GNUNET_YES ==
830 GNUNET_STRINGS_path_is_absolute (binaryexe,
831 GNUNET_NO,
832 NULL, NULL)) ||
829 (0 == strncmp (binary, "./", 2)) ) 833 (0 == strncmp (binary, "./", 2)) )
830 p = GNUNET_strdup (binaryexe); 834 p = GNUNET_strdup (binaryexe);
831 else 835 else
@@ -840,16 +844,24 @@ GNUNET_OS_check_helper_binary (const char *binary,
840 } 844 }
841 GNUNET_free (binaryexe); 845 GNUNET_free (binaryexe);
842#else 846#else
843 if ( (GNUNET_YES == GNUNET_STRINGS_path_is_absolute (binary, GNUNET_NO, 847 if ( (GNUNET_YES ==
844 NULL, NULL)) || 848 GNUNET_STRINGS_path_is_absolute (binary,
849 GNUNET_NO,
850 NULL,
851 NULL)) ||
845 (0 == strncmp (binary, "./", 2)) ) 852 (0 == strncmp (binary, "./", 2)) )
853 {
846 p = GNUNET_strdup (binary); 854 p = GNUNET_strdup (binary);
855 }
847 else 856 else
848 { 857 {
849 p = get_path_from_PATH (binary); 858 p = get_path_from_PATH (binary);
850 if (NULL != p) 859 if (NULL != p)
851 { 860 {
852 GNUNET_asprintf (&pf, "%s/%s", p, binary); 861 GNUNET_asprintf (&pf,
862 "%s/%s",
863 p,
864 binary);
853 GNUNET_free (p); 865 GNUNET_free (p);
854 p = pf; 866 p = pf;
855 } 867 }
@@ -862,9 +874,12 @@ GNUNET_OS_check_helper_binary (const char *binary,
862 binary); 874 binary);
863 return GNUNET_SYSERR; 875 return GNUNET_SYSERR;
864 } 876 }
865 if (0 != ACCESS (p, X_OK)) 877 if (0 != ACCESS (p,
878 X_OK))
866 { 879 {
867 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", p); 880 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
881 "access",
882 p);
868 GNUNET_free (p); 883 GNUNET_free (p);
869 return GNUNET_SYSERR; 884 return GNUNET_SYSERR;
870 } 885 }
@@ -873,22 +888,30 @@ GNUNET_OS_check_helper_binary (const char *binary,
873 { 888 {
874 /* as we run as root, we don't insist on SUID */ 889 /* as we run as root, we don't insist on SUID */
875 GNUNET_free (p); 890 GNUNET_free (p);
876 return GNUNET_OK; 891 return GNUNET_YES;
877 } 892 }
878#endif 893#endif
879 if (0 != STAT (p, &statbuf)) 894 if (0 != STAT (p,
895 &statbuf))
880 { 896 {
881 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", p); 897 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
898 "stat",
899 p);
882 GNUNET_free (p); 900 GNUNET_free (p);
883 return GNUNET_SYSERR; 901 return GNUNET_SYSERR;
884 } 902 }
885 if (check_suid){ 903 if (check_suid)
904 {
886#ifndef MINGW 905#ifndef MINGW
887 if ((0 != (statbuf.st_mode & S_ISUID)) && (0 == statbuf.st_uid)) 906 if ( (0 != (statbuf.st_mode & S_ISUID)) &&
907 (0 == statbuf.st_uid) )
888 { 908 {
889 GNUNET_free (p); 909 GNUNET_free (p);
890 return GNUNET_YES; 910 return GNUNET_YES;
891 } 911 }
912 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
913 _("Binary `%s' exists, but is not SUID\n"),
914 p);
892 /* binary exists, but not SUID */ 915 /* binary exists, but not SUID */
893#else 916#else
894 STARTUPINFO start; 917 STARTUPINFO start;