seedit/2.1.0-4.patch
2007-02-15 02:32:41 +00:00

72 lines
1.6 KiB
Diff

Index: Changelog
===================================================================
--- Changelog (リビジョン 644)
+++ Changelog (作業コピー)
@@ -1,3 +1,7 @@
+*2007/02/14
+ - Fixed bug
+ -- seedit-converter did not work when "//" is included in path
+
*2007/02/05
- Fixed installhelper-include.sh for asianux 2
- Add seedit-load.conf to customize obj_type filed of audit
Index: core/converter/action.c
===================================================================
--- core/converter/action.c (リビジョン 644)
+++ core/converter/action.c (作業コピー)
@@ -516,12 +516,42 @@
}
+/*replace '//' with '/' */
+char *remove_slash(char *path) {
+ char *buf;
+ char *result;
+ int len;
+ int i;
+ int j;
+ result = strdup(path);
+ len = strlen(path);
+ buf = (char *)my_malloc(sizeof(char) * (len + 1));
+ memset(buf, 0, sizeof(char) * (len + 1));
+
+ j = 0;
+ for (i=0; i < len; i++) {
+ if(path[i] == '/') {
+ if (i > 0 && path[i-1] == '/'){
+ /*do nothing*/
+ } else {
+ buf[j] = path[i];
+ j++;
+ }
+ } else {
+ buf[j] = path[i];
+ j++;
+ }
+ }
+ memcpy(result,buf,len+1);
+ free(buf);
+ return result;
+}
+
int register_file_rule(char *path){
char **dir_list;
- char *filename;
-
+ char *filename;
int state;
-
+ path = remove_slash(path);
state = get_file_state(path);
filename = get_filename(path, state);
add_file_user_list(filename);
@@ -540,7 +570,8 @@
/* when allow <dir>* is described, add dummy permission to dummy domain. */
label_child_dir(filename);
}
-
+
+ free(path);
return 0;
}