flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm <...@git.apache.org>
Subject [GitHub] flink pull request #2425: FLINK-3930 Added shared secret based authorization...
Date Wed, 19 Oct 2016 10:58:33 GMT
Github user mxm commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2425#discussion_r84032768
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyMessage.java
---
    @@ -57,24 +61,37 @@
     	// constructor in order to work with the generic deserializer.
     	// ------------------------------------------------------------------------
     
    -	static final int HEADER_LENGTH = 4 + 4 + 1; // frame length (4), magic number (4), msg
ID (1)
    +	static final int HEADER_LENGTH = 4 + 4 + 4 + 1; // frame length (4), magic number (4),
Cookie (4), msg ID (1)
     
     	static final int MAGIC_NUMBER = 0xBADC0FFE;
     
    +	static final int BUFFER_SIZE = 65536;
    +
    +	static final Charset DEFAULT_CHARSET = Charset.forName("utf-8");
    +
     	abstract ByteBuf write(ByteBufAllocator allocator) throws Exception;
     
     	abstract void readFrom(ByteBuf buffer) throws Exception;
     
     	// ------------------------------------------------------------------------
     
    -	private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte id) {
    -		return allocateBuffer(allocator, id, 0);
    +	private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte id, String secureCookie)
{
    +		return allocateBuffer(allocator, id, secureCookie, 0);
     	}
     
    -	private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte id, int length)
{
    +	private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte id, String secureCookie,
int length) {
    +		secureCookie = (secureCookie == null || secureCookie.length() == 0) ? "": secureCookie;
    --- End diff --
    
    This check seems unncecessary. The cookie should always be a valid String when it is passed.
Also, what is the purpose of assigning `""` when `secureCookie.length() == 0`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message