17c478bd9Sstevel@tonic-gate# 27c478bd9Sstevel@tonic-gate# CDDL HEADER START 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 509295472Sgww# Common Development and Distribution License (the "License"). 609295472Sgww# You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate# and limitations under the License. 127c478bd9Sstevel@tonic-gate# 137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate# 197c478bd9Sstevel@tonic-gate# CDDL HEADER END 207c478bd9Sstevel@tonic-gate# 217c478bd9Sstevel@tonic-gate# 2224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate# Use is subject to license terms. 247c478bd9Sstevel@tonic-gate# 25*9e678d63SAndy Fiddaman# Copyright 2020 OmniOS Community Edition (OmniOSce) Association. 26*9e678d63SAndy Fiddaman# 277c478bd9Sstevel@tonic-gate# build two versions, su and su.static 287c478bd9Sstevel@tonic-gate# su.static is dynamically linked; the .static suffix is historical. 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gatePROG = su 317c478bd9Sstevel@tonic-gateROOTFS_PROG = su.static 32a7872406SmeemDEFAULTFILES = su.dfl 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gateEMB_PROG = embedded_su 377c478bd9Sstevel@tonic-gateROOTEMB_PROG = $(ROOTLIB)/$(EMB_PROG) 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gatePROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG) 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate# set /usr/bin/su to 4555; set /sbin/su.static to 0555 427c478bd9Sstevel@tonic-gateFILEMODE = 04555 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate$(PROG_STATIC) := FILEMODE = 0555 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate# A reduced su.static is created, with just enough functionality 477c478bd9Sstevel@tonic-gate# to satisfy the needs of a single-user login with /usr not mounted. 487c478bd9Sstevel@tonic-gate# In particular, nss_files.so.1 may be dlopen()'ed at runtime. 49*9e678d63SAndy Fiddaman$(ROOTFS_PROG) := LDLIBS += -lbsm -lpam 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate# The standard su is fully functional. 527c478bd9Sstevel@tonic-gate$(PROG) := CPPFLAGS += -DDYNAMIC_SU 5306e1a714Sraf$(PROG) := LDLIBS += -lbsm -lpam -lsecdb 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gateCLOBBERFILES += $(ROOTFS_PROG) $(EMB_PROG) 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate.KEEP_STATE: 587c478bd9Sstevel@tonic-gate 59a7872406Smeemall: $(PROG) $(ROOTFS_PROG) $(EMB_PROG) 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate# install rule for non-setuid /sbin/su.static 627c478bd9Sstevel@tonic-gate# (exec'd by /sbin/sulogin when booting single user) 637c478bd9Sstevel@tonic-gate$(ROOTFS_PROG): $(PROG).c 647c478bd9Sstevel@tonic-gate $(LINK.c) $(PROG).c -o $@ $(LDLIBS) 657c478bd9Sstevel@tonic-gate $(POST_PROCESS) 667c478bd9Sstevel@tonic-gate 67a7872406Smeeminstall: all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \ 68a7872406Smeem $(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG) 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate$(ROOTSBINPROG): $(ROOTPROG) 717c478bd9Sstevel@tonic-gate $(RM) $(ROOTSBINPROG); \ 727c478bd9Sstevel@tonic-gate $(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG) 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate$(ROOTEMB_PROG): 757c478bd9Sstevel@tonic-gate $(RM) $(ROOTEMB_PROG); \ 767c478bd9Sstevel@tonic-gate $(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG) 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate$(EMB_PROG): 797c478bd9Sstevel@tonic-gate $(RM) $(EMB_PROG); \ 807c478bd9Sstevel@tonic-gate $(SYMLINK) $(PROG) $(EMB_PROG) 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gateclean: 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gateinclude ../Makefile.targ 85