You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by GitBox <gi...@apache.org> on 2020/08/21 06:43:55 UTC

[GitHub] [directory-kerby] liujiayi771 opened a new pull request #52: DIRKRB-749

liujiayi771 opened a new pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52


   Add change_password command line tool for remote kadmin tool


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] plusplusjiajia merged pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
plusplusjiajia merged pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] plusplusjiajia commented on a change in pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
plusplusjiajia commented on a change in pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52#discussion_r479976084



##########
File path: kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/request/ChangePasswordRequest.java
##########
@@ -0,0 +1,69 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.admin.kadmin.remote.request;
+
+import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.admin.message.AdminMessageCode;
+import org.apache.kerby.kerberos.kerb.admin.message.AdminMessageType;
+import org.apache.kerby.kerberos.kerb.admin.message.ChangePasswordReq;
+import org.apache.kerby.xdr.XdrDataType;
+import org.apache.kerby.xdr.XdrFieldInfo;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class ChangePasswordRequest extends AdminRequest {
+
+    private String newPassword = null;
+
+    public ChangePasswordRequest(String principal, String newPassword) {
+        super(principal);
+        this.newPassword = newPassword;
+    }
+
+    public String getNewPassword() {
+        return newPassword;
+    }
+
+    @Override
+    public void process() throws KrbException {
+        super.process();
+
+        ChangePasswordReq changePwdReq = new ChangePasswordReq();
+
+        XdrFieldInfo[] xdrFieldInfos = new XdrFieldInfo[4];
+        xdrFieldInfos[0] = new XdrFieldInfo(0, XdrDataType.ENUM, AdminMessageType.CHANGE_PWD_REQ);
+        xdrFieldInfos[1] = new XdrFieldInfo(1, XdrDataType.INTEGER, 2);
+        xdrFieldInfos[2] = new XdrFieldInfo(2, XdrDataType.STRING, getPrincipal());
+        xdrFieldInfos[3] = new XdrFieldInfo(3, XdrDataType.STRING, getNewPassword());
+
+        AdminMessageCode value = new AdminMessageCode(xdrFieldInfos);
+        byte[] encodeBytes;
+        try {
+            encodeBytes = value.encode();
+        } catch (IOException e) {
+            throw new KrbException("Xdr encode error when generate get principals request.", e);

Review comment:
       Wrong exception message?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] plusplusjiajia commented on pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
plusplusjiajia commented on pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52#issuecomment-684826600


   LGTM.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] plusplusjiajia commented on a change in pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
plusplusjiajia commented on a change in pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52#discussion_r479974139



##########
File path: kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
##########
@@ -103,6 +104,10 @@ public ByteBuffer handleMessage(ByteBuffer receivedMessage,
                 System.out.println("message type: export keytab req");
                 responseMessage = handleExportKeytabReq(localKadmin, fieldInfos);
                 break;
+            case CHANGE_PWD_REQ:
+                System.out.println("message type changePwd req");

Review comment:
       This message is better to be "message type: change password req".




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] liujiayi771 commented on a change in pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
liujiayi771 commented on a change in pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52#discussion_r480855865



##########
File path: kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
##########
@@ -103,6 +104,10 @@ public ByteBuffer handleMessage(ByteBuffer receivedMessage,
                 System.out.println("message type: export keytab req");
                 responseMessage = handleExportKeytabReq(localKadmin, fieldInfos);
                 break;
+            case CHANGE_PWD_REQ:
+                System.out.println("message type changePwd req");

Review comment:
       Already fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] plusplusjiajia commented on pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
plusplusjiajia commented on pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52#issuecomment-684828959


   @liujiayi771 Thanks for your contribution.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


[GitHub] [directory-kerby] plusplusjiajia commented on a change in pull request #52: DIRKRB-749

Posted by GitBox <gi...@apache.org>.
plusplusjiajia commented on a change in pull request #52:
URL: https://github.com/apache/directory-kerby/pull/52#discussion_r479979782



##########
File path: kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/command/RemoteChangePasswordCommand.java
##########
@@ -0,0 +1,52 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.admin.kadmin.remote.command;
+
+import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminClient;
+
+public class RemoteChangePasswordCommand extends RemoteCommand {
+    private static final String USAGE = "Usage: change_password [-pw newPassword] principal";
+
+    public RemoteChangePasswordCommand(AdminClient adminClient) {
+        super(adminClient);
+    }
+
+    @Override
+    public void execute(String input) throws KrbException {
+        String[] items = input.split("\\s+");
+
+        if (items.length < 4) {

Review comment:
       I think using "items.length != 4" is a better choice.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org