pymumu / jail-shell

Jail-shell is a linux security tool mainly using chroot, namespaces technologies, limiting users to perform specific commands, and access sepcific directories.
GNU General Public License v2.0
116 stars 20 forks source link

"make" error #1

Closed npsoni88 closed 6 years ago

npsoni88 commented 6 years ago

Environment - Ubuntu 16.04 in a Vagrant machine Immediate error after cloning the repo.

root@jenkins:~/jail-shell# make
make -C jail-cmd  all
make[1]: Entering directory '/root/jail-shell/jail-cmd'
cc -g -O2 -Werror -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing    -c -o jail-cmd.o jail-cmd.c
jail-cmd.c: In function ‘help’:
jail-cmd.c:46:2: error: format not a string literal and no format arguments [-Werror=format-security]
  printf(help);
  ^
jail-cmd.c: In function ‘cmd_init’:
jail-cmd.c:100:4: error: format not a string literal and no format arguments [-Werror=format-security]
    snprintf(cmd->term, TMP_BUFF_LEN_32, getenv("TERM"));
    ^
jail-cmd.c:100:4: error: format not a string literal and no format arguments [-Werror=format-security]
jail-cmd.c: In function ‘process_cmd’:
jail-cmd.c:191:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDOUT_FILENO, cmd_data->data, cmd_head->data_len);
   ^
jail-cmd.c:196:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDERR_FILENO, cmd_data->data, cmd_head->data_len);
   ^
cc1: all warnings being treated as errors
<builtin>: recipe for target 'jail-cmd.o' failed
make[1]: *** [jail-cmd.o] Error 1
make[1]: Leaving directory '/root/jail-shell/jail-cmd'
Makefile:14: recipe for target 'JAIL_CMD' failed
make: *** [JAIL_CMD] Error 2
pymumu commented 6 years ago

Jail-shell is compiled with -Werror CFLAGS, All compiler warnings will be treated as errors, so you can temporarily avoid this build error by remove -Werror flag in Makefile

JAIL_COMMON_OBJS=jail-common.o
JAIL_CMD_OBJS=jail-cmd.o $(JAIL_COMMON_OBJS)
JAIL_CMDD_OBJS=jail-cmdd.o $(JAIL_COMMON_OBJS)
JAIL_CMD=jail-cmd
JAIL_CMDD=jail-cmdd
JAIL_CMDD_LIB =  -lutil

CFLAGS +=-g -O2 -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing
CXXFLAGS +=-Wall -fno-omit-frame-pointer -Wstrict-aliasing

.PHONY: all

all: $(JAIL_CMD) $(JAIL_CMDD)

$(JAIL_CMD) : $(JAIL_CMD_OBJS)
        $(CC) $(CFLAGS) $^ -o $@

$(JAIL_CMDD) : $(JAIL_CMDD_OBJS)
        $(CC) $(CFLAGS) $^ -o $@ $(JAIL_CMDD_LIB)

clean:
        $(RM) $(JAIL_CMD) $(JAIL_CMD_OBJS) $(JAIL_CMDD) $(JAIL_CMDD_OBJS)

Anyway, I'll fix this issue.

pymumu commented 6 years ago

Compile issuse has been resolved.
This tool has only been verified on redhat, suse, debian, not verified on ubuntu.
If there is still a problem with installation, please feedback.