소스 검색

moved socket from cli to conf

tags/v1.0.0^0
Robin Thoni 7 년 전
부모
커밋
8ff15b915f
4개의 변경된 파일11개의 추가작업 그리고 10개의 파일을 삭제
  1. 2
    1
      milter-sasl.json
  2. 5
    8
      src/Interface/MainClass.cpp
  3. 2
    0
      src/Interface/MainClass.h
  4. 2
    1
      tests/milter-sasl.json

+ 2
- 1
milter-sasl.json 파일 보기

1
 {
1
 {
2
-  "key": "insert your AES key here"
2
+  "key": "insert your AES key here",
3
+  "socket": "inet:4242@localhost"
3
 }
4
 }

+ 5
- 8
src/Interface/MainClass.cpp 파일 보기

41
     commandLineParser.addOption(&configOption);
41
     commandLineParser.addOption(&configOption);
42
     CommandLineOption decryptOption("decrypt", 'd', "Decrypt DATA and exit. Can be specified multiple times. Use - to read from stdin.", "DATA");
42
     CommandLineOption decryptOption("decrypt", 'd', "Decrypt DATA and exit. Can be specified multiple times. Use - to read from stdin.", "DATA");
43
     commandLineParser.addOption(&decryptOption);
43
     commandLineParser.addOption(&decryptOption);
44
-    CommandLineOption socketOption("milter", 'm', "Launch milter and specify the socket to listen on (eg: inet:4242@localhost).", "SOCKET");
45
-    commandLineParser.addOption(&socketOption);
46
     CommandLineOption helpOption("help", 'h', "Show this help.");
44
     CommandLineOption helpOption("help", 'h', "Show this help.");
47
     commandLineParser.addOption(&helpOption);
45
     commandLineParser.addOption(&helpOption);
48
 
46
 
63
         std::cerr << "Failed to read configuration file: " << strerror(configResult) << std::endl;
61
         std::cerr << "Failed to read configuration file: " << strerror(configResult) << std::endl;
64
         return EX_NOINPUT;
62
         return EX_NOINPUT;
65
     }
63
     }
66
-    else if (socketOption.isSet())
67
-    {
68
-        return launchMilter(socketOption.getValue());
69
-    }
70
     else if (decryptOption.isSet())
64
     else if (decryptOption.isSet())
71
     {
65
     {
72
         return launchDecrypt(decryptOption.getValues());
66
         return launchDecrypt(decryptOption.getValues());
73
     }
67
     }
74
-
75
-    return commandLineParser.showHelp(EX_USAGE, true);
68
+    else
69
+    {
70
+        return launchMilter(_defaultSocket);
71
+    }
76
 }
72
 }
77
 
73
 
78
 sfsistat MainClass::mlfiHeader(SMFICTX *ctx)
74
 sfsistat MainClass::mlfiHeader(SMFICTX *ctx)
112
         Json::Value root;
108
         Json::Value root;
113
         reader.parse(stream, root);
109
         reader.parse(stream, root);
114
         _cryptoBusiness->setKey(root["key"].asString());
110
         _cryptoBusiness->setKey(root["key"].asString());
111
+        _defaultSocket = root["socket"].asString();
115
     }
112
     }
116
     return errno;
113
     return errno;
117
 }
114
 }

+ 2
- 0
src/Interface/MainClass.h 파일 보기

38
 
38
 
39
     std::shared_ptr<CryptoBusiness> _cryptoBusiness;
39
     std::shared_ptr<CryptoBusiness> _cryptoBusiness;
40
 
40
 
41
+    std::string _defaultSocket;
42
+
41
     static MainClass* _instance;
43
     static MainClass* _instance;
42
 
44
 
43
 };
45
 };

+ 2
- 1
tests/milter-sasl.json 파일 보기

1
 {
1
 {
2
-  "key": "x%p~;mZ(A4FG]CDj"
2
+  "key": "x%p~;mZ(A4FG]CDj",
3
+  "socket": "inet:4242@localhost"
3
 }
4
 }

Loading…
취소
저장