Server IP : 103.119.228.120 / Your IP : 18.117.172.189 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/git-1.8.3.1/contrib/persistent-https/ |
Upload File : |
// Copyright 2012 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "fmt" "log" "net" "os" "path/filepath" "syscall" ) // A Socket is a wrapper around a Unix socket that verifies directory // permissions. type Socket struct { Dir string } func defaultDir() string { sockPath := ".git-credential-cache" if home := os.Getenv("HOME"); home != "" { return filepath.Join(home, sockPath) } log.Printf("socket: cannot find HOME path. using relative directory %q for socket", sockPath) return sockPath } // DefaultSocket is a Socket in the $HOME/.git-credential-cache directory. var DefaultSocket = Socket{Dir: defaultDir()} // Listen announces the local network address of the unix socket. The // permissions on the socket directory are verified before attempting // the actual listen. func (s Socket) Listen() (net.Listener, error) { network, addr := "unix", s.Path() if err := s.mkdir(); err != nil { return nil, &net.OpError{Op: "listen", Net: network, Addr: &net.UnixAddr{Name: addr, Net: network}, Err: err} } return net.Listen(network, addr) } // Dial connects to the unix socket. The permissions on the socket directory // are verified before attempting the actual dial. func (s Socket) Dial() (net.Conn, error) { network, addr := "unix", s.Path() if err := s.checkPermissions(); err != nil { return nil, &net.OpError{Op: "dial", Net: network, Addr: &net.UnixAddr{Name: addr, Net: network}, Err: err} } return net.Dial(network, addr) } // Path returns the fully specified file name of the unix socket. func (s Socket) Path() string { return filepath.Join(s.Dir, "persistent-https-proxy-socket") } func (s Socket) mkdir() error { if err := s.checkPermissions(); err == nil { return nil } else if !os.IsNotExist(err) { return err } if err := os.MkdirAll(s.Dir, 0700); err != nil { return err } return s.checkPermissions() } func (s Socket) checkPermissions() error { fi, err := os.Stat(s.Dir) if err != nil { return err } if !fi.IsDir() { return fmt.Errorf("socket: got file, want directory for %q", s.Dir) } if fi.Mode().Perm() != 0700 { return fmt.Errorf("socket: got perm %o, want 700 for %q", fi.Mode().Perm(), s.Dir) } if st := fi.Sys().(*syscall.Stat_t); int(st.Uid) != os.Getuid() { return fmt.Errorf("socket: got uid %d, want %d for %q", st.Uid, os.Getuid(), s.Dir) } return nil }