Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
d710b265
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d710b265
编写于
9月 27, 2005
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/home/hpa/git/daemon
上级
148ccbb0
e8f71fce
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
74 addition
and
6 deletion
+74
-6
daemon.c
daemon.c
+68
-4
git-core.spec.in
git-core.spec.in
+6
-2
未找到文件。
daemon.c
浏览文件 @
d710b265
...
...
@@ -12,7 +12,13 @@
static
int
log_syslog
;
static
int
verbose
;
static
const
char
daemon_usage
[]
=
"git-daemon [--verbose] [--syslog] [--inetd | --port=n]"
;
static
const
char
daemon_usage
[]
=
"git-daemon [--verbose] [--syslog] [--inetd | --port=n] [--export-all] [directory...]"
;
/* List of acceptable pathname prefixes */
static
char
**
ok_paths
=
NULL
;
/* If this is set, git-daemon-export-ok is not required */
static
int
export_all_trees
=
0
;
static
void
logreport
(
int
priority
,
const
char
*
err
,
va_list
params
)
...
...
@@ -69,14 +75,62 @@ void loginfo(const char *err, ...)
va_end
(
params
);
}
static
int
path_ok
(
const
char
*
dir
)
{
const
char
*
p
=
dir
;
char
**
pp
;
int
sl
=
1
,
ndot
=
0
;
for
(;;)
{
if
(
*
p
==
'.'
)
{
ndot
++
;
}
else
if
(
*
p
==
'/'
||
*
p
==
'\0'
)
{
if
(
sl
&&
ndot
>
0
&&
ndot
<
3
)
return
0
;
/* . or .. in path */
sl
=
1
;
if
(
*
p
==
'\0'
)
break
;
/* End of string and all is good */
}
else
{
sl
=
ndot
=
0
;
}
p
++
;
}
if
(
ok_paths
&&
*
ok_paths
)
{
int
ok
=
0
;
int
dirlen
=
strlen
(
dir
);
/* read_packet_line can return embedded \0 */
for
(
pp
=
ok_paths
;
*
pp
;
pp
++
)
{
int
len
=
strlen
(
*
pp
);
if
(
len
<=
dirlen
&&
!
strncmp
(
*
pp
,
dir
,
len
)
&&
(
dir
[
len
]
==
'/'
||
dir
[
len
]
==
'\0'
)
)
{
ok
=
1
;
break
;
}
}
if
(
!
ok
)
return
0
;
/* Path not in whitelist */
}
return
1
;
/* Path acceptable */
}
static
int
upload
(
char
*
dir
,
int
dirlen
)
{
loginfo
(
"Request for '%s'"
,
dir
);
if
(
!
path_ok
(
dir
))
{
logerror
(
"Forbidden directory: %s
\n
"
,
dir
);
return
-
1
;
}
if
(
chdir
(
dir
)
<
0
)
{
logerror
(
"Cannot chdir('%s'): %s"
,
dir
,
strerror
(
errno
));
return
-
1
;
}
chdir
(
".git"
);
/*
...
...
@@ -86,10 +140,10 @@ static int upload(char *dir, int dirlen)
* a "git-daemon-export-ok" flag that says that the other side
* is ok with us doing this.
*/
if
(
access
(
"git-daemon-export-ok"
,
F_OK
)
||
if
(
(
!
export_all_trees
&&
access
(
"git-daemon-export-ok"
,
F_OK
)
)
||
access
(
"objects/00"
,
X_OK
)
||
access
(
"HEAD"
,
R_OK
))
{
logerror
(
"Not a valid git
d
-enabled repository: '%s'"
,
dir
);
logerror
(
"Not a valid git
-daemon
-enabled repository: '%s'"
,
dir
);
return
-
1
;
}
...
...
@@ -441,7 +495,6 @@ int main(int argc, char **argv)
continue
;
}
}
if
(
!
strcmp
(
arg
,
"--inetd"
))
{
inetd_mode
=
1
;
continue
;
...
...
@@ -455,6 +508,17 @@ int main(int argc, char **argv)
openlog
(
"git-daemon"
,
0
,
LOG_DAEMON
);
continue
;
}
if
(
!
strcmp
(
arg
,
"--export-all"
))
{
export_all_trees
=
1
;
continue
;
}
if
(
!
strcmp
(
arg
,
"--"
))
{
ok_paths
=
&
argv
[
i
+
1
];
break
;
}
else
if
(
arg
[
0
]
!=
'-'
)
{
ok_paths
=
&
argv
[
i
];
break
;
}
usage
(
daemon_usage
);
}
...
...
git-core.spec.in
浏览文件 @
d710b265
...
...
@@ -23,12 +23,12 @@ elsewhere for tools for ordinary humans layered on top of this.
%setup -q
%build
make
COPT
S="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease \
make
%{_smp_mflags} CFLAG
S="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease \
prefix=%{_prefix} all %{!?_without_docs: doc}
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT WITH_OWN_SUBPROCESS_PY=YesPlease \
make
%{_smp_mflags}
DESTDIR=$RPM_BUILD_ROOT WITH_OWN_SUBPROCESS_PY=YesPlease \
prefix=%{_prefix} mandir=%{_mandir} \
install %{!?_without_docs: install-doc}
...
...
@@ -45,6 +45,10 @@ rm -rf $RPM_BUILD_ROOT
%{!?_without_docs: %{_mandir}/man7/*.7*}
%changelog
* Tue Sep 27 2005 H. Peter Anvin <hpa@zytor.com>
- parallelize build
- COPTS -> CFLAGS
* Fri Sep 16 2005 Chris Wright <chrisw@osdl.org> 0.99.6-1
- update to 0.99.6
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录