オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Diff of /trunk/1.7.x/ccs-patch/security/ccsecurity/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 403 by kumaneko, Tue Aug 21 04:14:29 2007 UTC revision 418 by kumaneko, Fri Aug 24 02:17:17 2007 UTC
# Line 5  Line 5 
5   *   *
6   * Copyright (C) 2005-2007  NTT DATA CORPORATION   * Copyright (C) 2005-2007  NTT DATA CORPORATION
7   *   *
8   * Version: 1.5.0-pre   2007/08/17   * Version: 1.5.0-pre   2007/08/24
9   *   *
10   * This file is applicable to both 2.4.30 and 2.6.11 and later.   * This file is applicable to both 2.4.30 and 2.6.11 and later.
11   * See README.ccs for ChangeLog.   * See README.ccs for ChangeLog.
# Line 519  static struct profile *FindOrAssignNewPr Line 519  static struct profile *FindOrAssignNewPr
519          return ptr;          return ptr;
520  }  }
521    
522  static int SetStatus(struct io_buffer *head)  static int SetProfile(struct io_buffer *head)
523  {  {
524          char *data = head->write_buf;          char *data = head->write_buf;
525          unsigned int i, value;          unsigned int i, value;
# Line 536  static int SetStatus(struct io_buffer *h Line 536  static int SetStatus(struct io_buffer *h
536          cp = strchr(data, '=');          cp = strchr(data, '=');
537          if (!cp) return -EINVAL;          if (!cp) return -EINVAL;
538          *cp = '\0';          *cp = '\0';
539          UpdateCounter(CCS_UPDATES_COUNTER_STATUS);          UpdateCounter(CCS_UPDATES_COUNTER_PROFILE);
540          if (strcmp(data, ccs_control_array[CCS_PROFILE_COMMENT].keyword) == 0) {          if (strcmp(data, ccs_control_array[CCS_PROFILE_COMMENT].keyword) == 0) {
541                  profile->comment = SaveName(cp + 1);                  profile->comment = SaveName(cp + 1);
542                  return 0;                  return 0;
# Line 554  static int SetStatus(struct io_buffer *h Line 554  static int SetStatus(struct io_buffer *h
554          return -EINVAL;          return -EINVAL;
555  }  }
556    
557  static int ReadStatus(struct io_buffer *head)  static int ReadProfile(struct io_buffer *head)
558  {  {
559          if (!head->read_eof) {          if (!head->read_eof) {
560                  if (!isRoot()) return -EPERM;                  if (!isRoot()) return -EPERM;
# Line 1123  void CCS_LoadPolicy(const char *filename Line 1123  void CCS_LoadPolicy(const char *filename
1123                  path_release(&nd);                  path_release(&nd);
1124          }          }
1125  #ifdef CONFIG_SAKURA  #ifdef CONFIG_SAKURA
1126          printk("SAKURA: 1.5.0-pre   2007/08/16\n");          printk("SAKURA: 1.5.0-pre   2007/08/24\n");
1127  #endif  #endif
1128  #ifdef CONFIG_TOMOYO  #ifdef CONFIG_TOMOYO
1129          printk("TOMOYO: 1.5.0-pre   2007/08/21\n");          printk("TOMOYO: 1.5.0-pre   2007/08/24\n");
1130  #endif  #endif
1131          if (!profile_loaded) {          if (!profile_loaded) {
1132                  char *argv[2], *envp[3];                  char *argv[2], *envp[3];
# Line 1365  static int ReadUpdatesCounter(struct io_ Line 1365  static int ReadUpdatesCounter(struct io_
1365                                    "/proc/ccs/system_policy:    %10u\n"                                    "/proc/ccs/system_policy:    %10u\n"
1366                                    "/proc/ccs/domain_policy:    %10u\n"                                    "/proc/ccs/domain_policy:    %10u\n"
1367                                    "/proc/ccs/exception_policy: %10u\n"                                    "/proc/ccs/exception_policy: %10u\n"
1368                                    "/proc/ccs/status:           %10u\n"                                    "/proc/ccs/profile:          %10u\n"
1369                                    "/proc/ccs/query:            %10u\n"                                    "/proc/ccs/query:            %10u\n"
1370                                    "/proc/ccs/manager:          %10u\n"                                    "/proc/ccs/manager:          %10u\n"
1371                                    "/proc/ccs/grant_log:        %10u\n"                                    "/proc/ccs/grant_log:        %10u\n"
# Line 1373  static int ReadUpdatesCounter(struct io_ Line 1373  static int ReadUpdatesCounter(struct io_
1373                                    counter[CCS_UPDATES_COUNTER_SYSTEM_POLICY],                                    counter[CCS_UPDATES_COUNTER_SYSTEM_POLICY],
1374                                    counter[CCS_UPDATES_COUNTER_DOMAIN_POLICY],                                    counter[CCS_UPDATES_COUNTER_DOMAIN_POLICY],
1375                                    counter[CCS_UPDATES_COUNTER_EXCEPTION_POLICY],                                    counter[CCS_UPDATES_COUNTER_EXCEPTION_POLICY],
1376                                    counter[CCS_UPDATES_COUNTER_STATUS],                                    counter[CCS_UPDATES_COUNTER_PROFILE],
1377                                    counter[CCS_UPDATES_COUNTER_QUERY],                                    counter[CCS_UPDATES_COUNTER_QUERY],
1378                                    counter[CCS_UPDATES_COUNTER_MANAGER],                                    counter[CCS_UPDATES_COUNTER_MANAGER],
1379                                    counter[CCS_UPDATES_COUNTER_GRANT_LOG],                                    counter[CCS_UPDATES_COUNTER_GRANT_LOG],
# Line 1408  int CCS_OpenControl(const int type, stru Line 1408  int CCS_OpenControl(const int type, stru
1408          init_MUTEX(&head->write_sem);          init_MUTEX(&head->write_sem);
1409          switch (type) {          switch (type) {
1410  #ifdef CONFIG_TOMOYO  #ifdef CONFIG_TOMOYO
1411          case CCS_POLICY_DOMAINPOLICY:          case CCS_DOMAINPOLICY:
1412                  head->write = AddDomainPolicy;                  head->write = AddDomainPolicy;
1413                  head->read = ReadDomainPolicy;                  head->read = ReadDomainPolicy;
1414                  break;                  break;
1415          case CCS_POLICY_EXCEPTIONPOLICY:          case CCS_EXCEPTIONPOLICY:
1416                  head->write = AddExceptionPolicy;                  head->write = AddExceptionPolicy;
1417                  head->read = ReadExceptionPolicy;                  head->read = ReadExceptionPolicy;
1418                  break;                  break;
1419          case CCS_POLICY_DOMAIN_STATUS:          case CCS_DOMAIN_STATUS:
1420                  head->write = UpdateDomainProfile;                  head->write = UpdateDomainProfile;
1421                  head->read = ReadDomainProfile;                  head->read = ReadDomainProfile;
1422                  break;                  break;
1423          case CCS_INFO_PROCESS_STATUS:          case CCS_PROCESS_STATUS:
1424                  head->write = WritePID;                  head->write = WritePID;
1425                  head->read = ReadPID;                  head->read = ReadPID;
1426                  break;                  break;
1427          case CCS_INFO_GRANTLOG:          case CCS_GRANTLOG:
1428                  head->poll = PollGrantLog;                  head->poll = PollGrantLog;
1429                  head->read = ReadGrantLog;                  head->read = ReadGrantLog;
1430                  break;                  break;
1431          case CCS_INFO_REJECTLOG:          case CCS_REJECTLOG:
1432                  head->poll = PollRejectLog;                  head->poll = PollRejectLog;
1433                  head->read = ReadRejectLog;                  head->read = ReadRejectLog;
1434                  break;                  break;
1435          case CCS_INFO_SELFDOMAIN:          case CCS_SELFDOMAIN:
1436                  head->read = ReadSelfDomain;                  head->read = ReadSelfDomain;
1437                  break;                  break;
1438  #endif  #endif
1439  #ifdef CONFIG_SAKURA  #ifdef CONFIG_SAKURA
1440          case CCS_POLICY_SYSTEMPOLICY:          case CCS_SYSTEMPOLICY:
1441                  head->write = AddSystemPolicy;                  head->write = AddSystemPolicy;
1442                  head->read = ReadSystemPolicy;                  head->read = ReadSystemPolicy;
1443                  break;                  break;
# Line 1446  int CCS_OpenControl(const int type, stru Line 1446  int CCS_OpenControl(const int type, stru
1446                  head->read = ReadVersion;                  head->read = ReadVersion;
1447                  head->readbuf_size = 128;                  head->readbuf_size = 128;
1448                  break;                  break;
1449          case CCS_INFO_MEMINFO:          case CCS_MEMINFO:
1450                  head->read = ReadMemoryCounter;                  head->read = ReadMemoryCounter;
1451                  head->readbuf_size = 128;                  head->readbuf_size = 128;
1452                  break;                  break;
1453          case CCS_STATUS:          case CCS_PROFILE:
1454                  head->write = SetStatus;                  head->write = SetProfile;
1455                  head->read = ReadStatus;                  head->read = ReadProfile;
1456                  break;                  break;
1457          case CCS_POLICY_QUERY:          case CCS_QUERY:
1458                  head->poll = PollQuery;                  head->poll = PollQuery;
1459                  head->write = WriteAnswer;                  head->write = WriteAnswer;
1460                  head->read = ReadQuery;                  head->read = ReadQuery;
1461                  break;                  break;
1462          case CCS_POLICY_MANAGER:          case CCS_MANAGER:
1463                  head->write = AddManagerPolicy;                  head->write = AddManagerPolicy;
1464                  head->read = ReadManagerPolicy;                  head->read = ReadManagerPolicy;
1465                  break;                  break;
1466          case CCS_INFO_UPDATESCOUNTER:          case CCS_UPDATESCOUNTER:
1467                  head->read = ReadUpdatesCounter;                  head->read = ReadUpdatesCounter;
1468                  break;                  break;
1469          }          }
1470          if (type != CCS_INFO_GRANTLOG && type != CCS_INFO_REJECTLOG && type != CCS_POLICY_QUERY) {          if (type != CCS_GRANTLOG && type != CCS_REJECTLOG && type != CCS_QUERY) {
1471                  if (!head->readbuf_size) head->readbuf_size = PAGE_SIZE * 2;                  if (!head->readbuf_size) head->readbuf_size = PAGE_SIZE * 2;
1472                  if ((head->read_buf = ccs_alloc(head->readbuf_size)) == NULL) {                  if ((head->read_buf = ccs_alloc(head->readbuf_size)) == NULL) {
1473                          ccs_free(head);                          ccs_free(head);
# Line 1483  int CCS_OpenControl(const int type, stru Line 1483  int CCS_OpenControl(const int type, stru
1483                  }                  }
1484          }          }
1485          file->private_data = head;          file->private_data = head;
1486          if (type == CCS_INFO_SELFDOMAIN) CCS_ReadControl(file, NULL, 0);          if (type == CCS_SELFDOMAIN) CCS_ReadControl(file, NULL, 0);
1487          else if (head->write == WriteAnswer) atomic_inc(&queryd_watcher);          else if (head->write == WriteAnswer) atomic_inc(&queryd_watcher);
1488          return 0;          return 0;
1489  }  }

Legend:
Removed from v.403  
changed lines
  Added in v.418

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26